topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Saturday December 14, 2024, 7:59 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Dina for Linux/X11 - solved !  (Read 50808 times)

bpcw001

  • Honorary Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 11
    • View Profile
    • Donate to Member
Dina for Linux/X11 - solved !
« on: March 22, 2007, 06:33 PM »
Hallo,

I just wanted to let you know that I finally managed to create a set of .BDF and .PCF files
that work with Linux X11 in both the "old" X font system as well as with fontconfig :)

I'd like to share these for every Linux user out there who wants to use the excellent Dina programming
font.
Hence, if somebody feels like hosting two 40K tar.gz files somewhere, please let me know

bpcw001


jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Dina for Linux/X11 - solved !
« Reply #1 on: March 22, 2007, 06:58 PM »
bpcw001: you can just attach it to a post here! :)

bpcw001

  • Honorary Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 11
    • View Profile
    • Donate to Member
Re: Dina for Linux/X11 - solved !
« Reply #2 on: March 22, 2007, 07:09 PM »
Oh, I didn't realize that. OK. Here come the files. Enjoy!

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Dina for Linux/X11 - solved !
« Reply #3 on: March 22, 2007, 09:12 PM »
wonderful!
I hope jibz will add these to his official download page for Dina as well.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Dina for Linux/X11 - solved !
« Reply #4 on: March 23, 2007, 01:55 AM »
Great for the linux users! :)

You might want to tell the world how you managed to do it?
- carpe noctem

bpcw001

  • Honorary Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 11
    • View Profile
    • Donate to Member
Re: Dina for Linux/X11 - solved !
« Reply #5 on: March 23, 2007, 04:29 AM »
Sure. No secret here. It's basically the procedure I described in my previous thread about Dina.

1. Take the Windows .FON file and convert it to .BDF files with fnt2bdf (which comes with Wine).
2. The .BDF files generated by this tool are pretty incomplete in terms of header information. That's why the fonts basically work in X, but fontconfig
    requires well-formed BDFs so it doesn't pick them up.
    Since .BDF files are text files, I found out which header information to add by reading the BDF spec and comparing the Dina headers to the headers of a bitmap font that already worked
    with X and fontconfig.
    Hence, I completed the missing info in the Dina .BDF headers. It is basically information like slant, weight, font name and - as seems most important - the encoding info which is needs
    to be set to ISO8859-1 for fontconfig to pick it up.
3. Convert .BDF files to .PCF files with bdftopcf (standard X tool).

Yeah, it's always easy as soon as you know how to do it right  ;)

Installation of the fonts
=================
1. In theory, you can use either the .BDF files or the .PCF files. The .PCF files are compiled and may provide better performance in X. I only tested with .PCFs.
2. Just copy the set of font files to a directory which is in X's and fontconfig's font path.
3. run "mkfontdir" in the respective font directory.
4. run "xset fp rehash"
5. run "fc-cache -f"
6. check with "fc-list | grep Dina" that Dina is there as medium, bold, italic, and bold italic.
7. Restart KDE or GNOME or whatever desktop environment you might use in order to have Dina available
   in the font selection dialogs.

bpcw001
« Last Edit: March 23, 2007, 05:19 AM by bpcw001 »

bpcw001

  • Honorary Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 11
    • View Profile
    • Donate to Member
Re: Dina for Linux/X11 - solved !
« Reply #6 on: March 23, 2007, 04:32 AM »
Learned how to use the "modify" function  ;)
« Last Edit: March 23, 2007, 05:18 AM by bpcw001 »

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Dina for Linux/X11 - solved !
« Reply #7 on: March 23, 2007, 04:36 AM »
You can use 'edit post' instead of posting another one :)

Just to be pesky, perhaps you can outline which header entries you needed to fix? Sorry for bugging, but this could end up being a good little cookbook recipe, perhaps something to add as a MINI-HOWTO.
- carpe noctem

bpcw001

  • Honorary Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 11
    • View Profile
    • Donate to Member
Re: Dina for Linux/X11 - solved !
« Reply #8 on: March 23, 2007, 05:04 AM »
Sure. For example: Dina 8pt, italic, medium

fnt2bdf conversion generates a .BDF containing the old style font name. However, it misses to incorporate
significant info contained in this font string into the BDF properties part. The important bulding blocks for our purpose are:
                                                                                                         
                                                                Name        Slant   X and Y resolution in DPI      original encoding
                                                                  |              |                      |    |               |
-> generated old style X font name: -windows-Dina-medium-i-normal--13-80-96-96-c-70-microsoft-cp1252
                                                                          |                     |   |   
                                                                        Weight       Pixelsize   Pointsize                               

So what I added in the properties section of the BDF is:

FACE_NAME "Dina"                  -> font face
FAMILY_NAME "Dina"               -> font family
WEIGHT_NAME "Medium"          -> "Medium" or "Bold", dependent on what we have
SLANT "I"                              -> "I" for Italic, "R" for regular non-italics. Without this, fontconfig can't tell the difference between Italic and Regular font shapes!
PIXEL_SIZE 13                       -> this is the pixelsize found in the generated old-style X font name
POINT_SIZE 80                      -> this is the point size found in the generated old-style X font name
RESOLUTION_X 96                  -> X-resolution found in the generated old-style X font name
RESOLUTION_Y 96                  -> Y-resolution found in the generated old-style X font name
CHARSET_REGISTRY "ISO8859" -> encoding: first part
CHARSET_ENCODING "1"          -> encoding: second part, so whole encoding will be iso8859-1

The encoding stuff is bit of magic and I admit that I'm not perfectly clear why this works, since the original encoding is Microsoft cp1252 and I claim it to be ISO8859-1 in the BDF.
I found out that it needs to be done that way for fontconfig to pick the font up, and it is the way other bitmapped fonts converted from Windows do it too.
Contrary to my first attempts where I actually tried to re-encode the fonts from Microsoft encoding to iso8859-1, this is just a "redeclaration" of the encoding.
Maybe it works because the first 128 or 255 characters are at the same places in both encodings anyway.

The properties section in a BDF is enclosed by the keywords STARTPROPERTIES and ENDPROPERTIES. The number found after STARTPROPERTIES is the number of properties actually found between these two key words, so if you add/remove property entries, be sure to adjust this number accordingly, otherwise bdftopcf will bail out with an error when compilation into .PCF is attempted.

I'm just wondering about providing a custom version of fnt2bdf which does all that or at least allows to specify things via command line parameters.
Once I'll find the time, I might have a look at the fnt2bdf source code.


bpcw001
« Last Edit: March 23, 2007, 05:16 AM by bpcw001 »

donarique

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
Re: Dina for Linux/X11 - solved !
« Reply #9 on: June 04, 2007, 02:22 PM »
This is just what I was looking for.
Thanks a lot bpcw001!

jsyjr

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
Re: Dina for Linux/X11 - solved !
« Reply #10 on: November 10, 2007, 10:18 AM »
Can anyone provide directions for installing Dina on Ubuntu Gutsy?  In particular I would like to use it with emacs.  tia

bpcw001

  • Honorary Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 11
    • View Profile
    • Donate to Member
Re: Dina for Linux/X11 - solved !
« Reply #11 on: January 08, 2008, 09:42 AM »
Can anyone provide directions for installing Dina on Ubuntu Gutsy?  In particular I would like to use it with emacs.  tia

Ubuntu has bitmapped fonts disabled by default.
You need to run "dpkg-reconfigure fontconfig-config". At some point of the dialogs that come up you will be asked if you'd like to enable bitmapped fonts. Answer this with yes.
Then, unpack the Dina PCF files in any directory below /usr/share/fonts (e. g. into /usr/share/fonts/Dina) and run "dpkg-reconfigure fontconfig".
Open a console and check with "fc-list | grep Dina" that Dina is there as medium, bold, italic, and bold italic.

Now that the font should be available to X11, Gnome and KDE.

Emacs may have its own font configuration mechanism. Since I don't use emacs, I wouldn't know about that. Sorry.
Maybe someone else here can fill us in on the emacs font selection.


rxantos

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 116
    • View Profile
    • Donate to Member
Re: Dina for Linux/X11 - solved !
« Reply #12 on: May 20, 2010, 11:06 PM »
This worked for me on ubuntu 10 LTS

sudo mkdir /usr/share/fonts/Dina
sudo cp Dina-PCF.tar.gz /usr/share/fonts/Dina
cd /usr/share/fonts/Dina
sudo tar -xvf Dina-PCF.tar.gz
sudo rm Dina-PCF.tar.gz
sudo rm /etc/fonts/conf.d/70-no-bitmaps.conf
sudo fc-cache -f -v

The last 2 lines I got from here:
http://www.alanbriol...ts-on-ubuntu-jaunty/


@bpcw001 Thank you for passing this to linux.  I really like this font.

msx_

  • Participant
  • Joined in 2012
  • *
  • Posts: 1
    • View Profile
    • Donate to Member
Re: Dina for Linux/X11 - solved !
« Reply #13 on: February 05, 2012, 02:32 PM »
This worked for me on ubuntu 10 LTS

sudo mkdir /usr/share/fonts/Dina
sudo cp Dina-PCF.tar.gz /usr/share/fonts/Dina
cd /usr/share/fonts/Dina
sudo tar -xvf Dina-PCF.tar.gz
sudo rm Dina-PCF.tar.gz
sudo rm /etc/fonts/conf.d/70-no-bitmaps.conf
sudo fc-cache -f -v

The last 2 lines I got from here:
http://www.alanbriolat.co.uk/2009/04/enable-bitmap-fonts-on-ubuntu-jaunty/


@bpcw001 Thank you for passing this to linux.  I really like this font.

Thanks the autor of this awesome font for releasing it free and the rest of the guys for posting the tuto to make it work in buntuland! (Linux Mint 12 here).
I confirm that as this Sunday February 5th Dina's .PCF font files still works smooth.