Next Previous Contents

4. TrueType Fonts (One of the few things Windows is good for)

Because the boys at Redmond are very concerned with the appearance of their software (as opposed to the internal workings ;) they built TrueType font support into Windows. Windows 95 and nearly every other variety of Windows comes with Arial, Times New Roman, and Courier New, which are roughly equivalant to Helvetica, Times and Courier. TrueType fonts are scalable, so they look good in large sizes, and they are well hinted, so they are readable at small sizes. Many windows applications come with dozens of TrueType fonts. Don't microwave your Windows CD yet, you'll want to get the fonts first.

4.1 xfstt

Unfortunately, XFree86 does not come with built in TrueType support, so you'll have to add it yourself. The easiest way of doing this is with xfstt, a free TrueType font server.

Installation

xfstt is very easy to install. First, you'll want to download the tarball from the web. The most current version is at http://metalab.unc.edu/pub/Linux/X11/fonts/Xfstt-0.9.10.tgz

Once you have the tarball, untar it.

tar -zxvf Xfstt-0.9.10.tgz

Then build it and install it. Read the INSTALL file for quick instructions, but it's a no brainer. make; make install is all you have to do. Once that's done, copy the TrueType fonts you've managed to get from various sources to /usr/ttfonts, and you're ready to go. Start xfstt by typing

xfstt --sync        # updates xfstt's font database
xfstt &             # runs xfstt in the background.

Then type

xset +fp unix/:7100 # tells X about xfstt.

or add

FontPath "unix/:7100"

to your XF86Config to tell X about the font service.

Adjusting the default font size

If your TrueType fonts appear to be very tiny, the following commands help.

Add the -dpi switch to your X server command line (see section 3 to do this.)

Use the --res switch to tell xfstt to increase the default resolution. Use the following command line.

xfstt --res 120

4.2 xfs

xfs is an alternative font server that is now being included with RedHat based distributions. xfs is based on the FreeType Font library and provides similar functionality to xfstt. xfs is able to serve both TrueType and Type 1 fonts, as well as legacy X fonts.

Installation

First step is to add TrueType Fonts to your linux filesystem. Su to root, and make a directory to hold the fonts:

mkdir /usr/share/fonts/ttfonts

Then, add fonts to this directory, either by copying them from your Windows system:

cp /mnt/win/path_to_fonts/*ttf  /usr/share/fonts/ttfonts/

or by downloading those available directly from Microsoft.

These fonts are in self-extracting zip archives. You can still install them though in linux

unzip <TTFONT.EXE>

Note that the font file names must be lower case. One quick and easy way to convert them is to copy them to a DOS (FAT16) filesystem and then copy them back. DOS doesn't do upper case. For a more linuxian way, go to the directory containing the fonts and type this:

ls *TTF | while read f
do
 [ -f "$f" ] && mv -f "$f" "`echo \"$f\" | tr A-Z a-z`"
done

You'll get the ">" prompt as you type each line, hit return at the end of each line above. Note the punctuation -- those "backquotes" are important! Once the TrueType fonts are properly installed, as root:

ttmkfdir -o fonts.scale
mkfontdir

Rerun these commands anytime the contents of your font directory changes. Next, edit the xfs font config file, /etc/X11/fs/config, to add your TrueType fonts to the server's font list:

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/share/fonts/default/Type1,
            /usr/share/fonts/ttfonts,
            /usr/X11R6/lib/X11/fonts/100dpi,
            /usr/X11R6/lib/X11/fonts/75dpi

Alternately, you can use the 'chkfontpath --add <font>' command to add fonts. While you're at it, you may want to change the default point size too.

default-point-size = 140

This gives me 14 point, instead of the default 12. Some X apps use this, some won't. Next, make sure the FontPath line in /etc/X11/XF86Config is:

FontPath "unix/:-1"

Note that "unix/:7100" may also do the trick, but did not work with the initial release. Comment out any existing FontPath with '#' since you no longer need it. The xfs package itself should be installed already with the other XFree packages. To make sure it runs as one of the default services either use 'ntsysv' or

chkconfig --add xfs

Now xfs will start every time you boot. Now restart X to force the new FontPath and start/restart xfs

/etc/rc.d/init.d/xfs restart

You should now have a functioning font server. You can check which fonts are being served:

xlsfonts | less

or check them out further with xfontsel, and even better, gfontsel!


Next Previous Contents