12.4. Using Fonts in XFree86

12.4.1. TrueType Fonts

The default fonts that ship with XFree86 are less than ideal for typical desktop publishing applications. Large presentation fonts show up jagged and unprofessional looking and small fonts in Netscape are almost completely unintelligable. Fortunately, XFree86 can be configured to use TrueType fonts with a minimum of effort.

XFree86 4.0 has built in support for rendering TrueType fonts. There are two different modules that can enable this functionality. The "freetype" module is used in this example because it is more consistent with the other font rendering backends. To enable the freetype module just add the following line to the module section of your /etc/X11/XF86Config file.

      Load  "freetype"


For XFree86 3.3.X you will need to run a seperate TrueType font server. Xfstt is commonly used for this purpose. To install Xfstt on your FreeBSD system simply install the port from /usr/ports/x11-servers/Xfstt

You should now make a directory for your TrueType fonts (e.g. /usr/X11R6/lib/X11/fonts/TrueType) and copy all of your TrueType fonts into this directory. Keep in mind that you can not take TrueType fonts directly from a Macintosh; they must be in Unix/DOS/Windows format for use by XFree86. Once you have copied the files into this directory you need to use ttmkfdir to create a fonts.dir file so that the X font renderer knows that you've installed these new files. There is a FreeBSD port for ttmkfdir in /usr/ports/x11-fonts/ttmkfdir.

        # cd /usr/X11R6/lib/X11/fonts/TrueType
        # ttmkfdir > fonts.dir

Now you need to add your TrueType directory to your fonts path. The easiest way to do this is to add the following entries into your ~/.xinitrc file.

        % xset fp+ /usr/X11R6/lib/X11/fonts/TrueType
        % xset fp rehash

That's it. Now Netscape, Gimp, StarOffice, and all of your other X applications should now recognize your installed TrueType fonts. Extremely small fonts (as with text in a high resolution display on a web page) and extremely large fonts (within StarOffice) will look much better now.

One Caveat : XFree86 does not currently support anti-aliased font rendering. This is less of an issue at higher screen resolutions but the output is still less than optimal when compared with MacOS or Microsoft Windows.

For questions about FreeBSD, e-mail <questions@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.