DæmonNews: News and views for the BSD community

November 2000 Get BSD New to BSD? Search BSD Submit News FAQ Contact Us Join Us
Search


Get BSD Stuff

Using TrueType fonts with XFree86

by Murray Stokely <murray@freebsd.org>

After all of the attention that my laptop received at BSDCon it became clear to me that many users are still putting up with the horrible default fonts in XFree86. I'm sure most of you have encountered some of the symptoms; completely unintelligible small fonts in Netscape, large presentation fonts that look jagged and unprofessional, etc. Fortunately, setting up your system to take advantage of more esthetically pleasing TrueType fonts is a 5 minute task.

How default fonts measure up to TrueType in StarOffice.

With TrueType FontsWithout TrueType Fonts

Times New Roman 24pt


Times New Roman 36pt

XFree86 4.0 has built in support for rendering TrueType fonts. There are two different modules that can enable this functionality. I will use the "freetype" module in this example because it was the first I tried and proved to be completely straightforward. 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 separate 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 (I would recommend /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 more information about typography on the web please see :




Author maintains all copyrights on this article.
Images and layout Copyright © 1998-2004 Dæmon News. All Rights Reserved.