Using TrueType Fonts with Red Hat Linux

Hopefully, this entire page will become obsolete soon, thanks to fontconfig.

See Also

Using TrueType Fonts with Red Hat 6.0

  1. Become root.
  2. (Optional) If the directory containing the TrueType fonts you want to use is on your Windows partition, mount that partition on, say, /dos/c as follows:
    1. Edit /etc/fstab to include a line like this one:
      /dev/hda1               /dos/c                  vfat    rw      0 0
      
    2. Create the directories /dos and /dos/c with the command 'mkdir -p /dos/c'.
    3. Give the command 'mount /dos/c'.
  3. Go to the directory containing the TrueType fonts you want to add, and use ttmkfdir to create the font directory file needed by xfs. For instance:
    cd /dos/c/Windows/fonts
    /usr/sbin/ttmkfdir > fonts.dir
    (Note: In Red Hat 6.1, ttmkfdir moved to /usr/bin, so adjust accordingly.)
  4. Add the new font directory to xfs's search path with chkfontpath --add. For instance:
    /usr/sbin/chkfontpath --add /dos/c/Windows/fonts
You can verify the new fonts exist by running xfontsel or kde's font manager, or in Netscape by going to Edit/Preferences/Fonts. (If you can't get Netscape to use the new fonts, make sure you have it set to not override the fonts picked by web pages.)

If you add more fonts to that directory later, you'll need to rereun ttmkfdir, and restart the font server with the command
/etc/rc.d/init.d/xfs restart

If you want your new fonts to override the old fonts, you'll need to rearrange the order of lines in the 'catalog' line of the file managed by chkfontpath, /etc/X11/fs/config. For instance, it might contain

catalogue = /usr/X11R6/lib/X11/fonts/misc:unscaled,
        /usr/X11R6/lib/X11/fonts/100dpi:unscaled,
        /usr/X11R6/lib/X11/fonts/75dpi:unscaled,
        /usr/X11R6/lib/X11/fonts/misc,
        /usr/X11R6/lib/X11/fonts/Type1,
        /usr/X11R6/lib/X11/fonts/Speedo,
        /usr/X11R6/lib/X11/fonts/75dpi,
        /dos/c/Windows/fonts 
To get the TrueType fonts in /dos/c/Windows/fonts to be used instead of other fonts, move it ahead of the other directories:
catalogue = /dos/c/Windows/fonts ,
        /usr/X11R6/lib/X11/fonts/misc:unscaled,
        /usr/X11R6/lib/X11/fonts/100dpi:unscaled,
        /usr/X11R6/lib/X11/fonts/75dpi:unscaled,
        /usr/X11R6/lib/X11/fonts/misc,
        /usr/X11R6/lib/X11/fonts/Type1,
        /usr/X11R6/lib/X11/fonts/Speedo,
        /usr/X11R6/lib/X11/fonts/75dpi
and restart the font server with the command /etc/rc.d/init.d/xfs restart

Note: one user reports that Netscape's Java has trouble with some TrueType fonts, and that moving the 75dpi or 100dpi fonts to near the top of the list avoids the problem. Not sure if this is really true.

For more info, see the Red Hat 6.0 font support whitepaper and the 'xfs' and 'chkfontpath' man pages.

Using TrueType Fonts with Red Hat 5.2

Approach #1: Font Server

Setting up a font server

Red Hat comes with version 0.9.9 of xfstt, an X Font Server for True Type fonts. Take a look at /etc/rc.d/init.d/xfstt. It looks in /usr/X11R6/lib/X11/fonts/ttfonts for TrueType fonts. That directory is normally empty, but you can fill it with your Windows fonts, e.g.
	# cd /usr/X11R6/lib/X11/fonts/ttfonts
	# mount /dos/c
	# cp /dos/c/windows/fonts/*.ttf .
The font server will have access to the new fonts after the next time you boot. If you're impatient, you can access them right away by giving the commands
	# cd /etc/rc.d/init.d
	# ./xfstt restart
(Note that "./". It's important. If you leave it off, you might get the real xfstt instead of the script in /etc/rc.d/init.d.)

Telling X to refer to the font server

Having a font server won't do you any good unless X knows to go get fonts from it. X looks at the file /etc/X11/XF86Config to tell where to read fonts. Add a line
    FontPath   "unix/:7100"
at the bottom of the group of FontPath lines, and restart X.

To check whether this worked, list available fonts with the command

	% xlsfonts | grep tt
You should see some fonts with -ttf- listed as the foundry.

Note: XConfigurator overwrites /etc/X11/XF86Config every time it runs, so you'll need to redo this step every time you reconfigure X for your graphics card.

Also note: It's rumored that KDE1.1 has trouble dealing with xfstt. Beware!

Troubleshooting

If xfstt complains "/usr/ttfonts" does not exist!, you probably tried to start it by hand, and accidentally ran /usr/X11R6/bin/xfstt (the real program) instead of /etc/rc.d/init.d/xfstt (the script used to start xfstt automatically at boot time). (Take a look at /etc/rc.d/init.d/xfstt with a text editor; you can see it passing options to the real xfstt to say where fonts live.) This can easily happen if you are in /etc/rc.d/init.d, . is not on your path, and you run it by typing 'xfstt' instead of './xfstt'.

Approach #2: Using a version of X with built-in TrueType support

This supposedly works with KDE. There are two versions I'm aware of:
Copyright 1999-2001 Dan Kegel
dank@alumni.caltech.edu
Last updated: 4 Oct 2002
[Return to www.kegel.com]