How to Use a BDF font with X11

Step 0

Before you start, it would be good to know if you already have a font directory in your home directory. Run "xset q", which will display various current X11 settings. One of the things it lists is your Font Path, which is the set of locations that are searched for fonts. If there is a directory in the list that is in your home directory, then you should use that directory, and you don't have to create a new directory.

Step 1

First (if you haven't done this before) you need a place to put the fonts. I suggest a directory called "fonts" in your home directory. Depending on your X11 version and configuration, you may need to make this directory world-readable.
  prompt: cd
  prompt: mkdir fonts
  prompt: chmod 755 fonts
  prompt: cd fonts

Step 2

Next, move the bdf file(s) into the fonts directory. These steps are the same if you just created the directory, or if you are adding new fonts to an existing directory. Again, the chmod may not be necessary in all cases. Please keep in mind that the filename is NOT the name that X11 will use for the font -- the X11 name is stored inside the file.
  prompt: mv /some/other/location/new_font_file.bdf ./new_font_file.bdf
  prompt: mkfontdir
  prompt: chmod 644 *

Step 3

If you are setting up a new font directory, you have to tell X11 about it. If the font directory already exists, and the fontpath already knows about it, you only need the second command below:
  prompt: xset fp+ $HOME/fonts
  prompt: xset fp rehash
In order to have this directory available with every login, you'll also need to add the above commands to your X11 startup script. This is usually the .xinitrc or .xsession file in your home directory. Under CDE, this is usually .dtprofile (in your home directory). Other X11 setups may use different files -- please ask your site administrator if you can't find the appropriate file.

Step 4

If you want to be able to refer to a font with a convenient name, you could edit the BDF file and change the name on the line labelled "FONT ". However, you can also make an alias for the file. By editing a file called fonts.alias in your fonts directory, you can give any font another name. The format is simply a line that contains the new name, tabs or spaces, and then the original name. The file can contain as many entries (lines) as you like. This file should also be made world-readable. After editing this file, you need to run "xset fp rehash" again.

Troubleshooting

If you have problems, check the following:

Links

Tom's BDF Font Editor
Tom's X11 Fonts
Tom's Big Nethack Font

Tom Fine's Home Send Me Email