"Linux Gazette...making Linux just a little more fun!"


The Xfstt True-Type Font Server

By Larry Ayers


Introduction

After using Linux for some time I had developed a less-than-favorable attitude towards TrueType fonts, partly because of their close association with Microsoft products and partly because of the high-quality printed output which Postscript fonts typically yield. I had become accustomed to the poor-quality of the X windows screen display when using scaled (rather than bit-mapped) PS fonts, only occasionally finding the un-aliased jagginess of certain font sizes jarring. This is particularly noticeable in Netscape when large fonts are displayed (titles, etc).

It was with some bemusement that I read various announcements of TrueType font-renderers and libraries for Linux in the past year. "Why", I wondered, "are people expending so much energy developing TTF support for Linux when Postscript fonts are supposed to be superior in so many ways?". I supposed these packages were for people who had bought TrueType fonts and wanted them available under Linux.

Last month I was idly scanning messages posted to the XEmacs-beta mailing list. I happened across a passing reference to the use of something called xfstt to provide TrueType fonts for XEmacs. The writer of the message stated that these fonts display well under X windows. This intrigued me, and later I happened to be discussing various Linux matters with Chris Gonnerman, who runs a small computer business in a nearby small town here in northern Missouri. He showed me a Linux machine running a TT font-server, which piqued my interest further.

A few days later I saw an announcement posted on the freshmeat web-site stating that xfstt-0.9.8 had just been released. Something about a new release irrationally induces me to try it out, so I got the package from Sunsite and compiled it.

Getting Xfstt to Work

Xfstt is being developed by Herbert Duerr, and as far as I can tell it seems to be a one-man project. The documentation is rather scanty, but the FAQ file in the distribution provides enough information to get started. Xfstt is a font server similar to X's native xfs. Once the server has been compiled and installed, all that needs to be done is to populate the directory  /usr/ttfonts  with *.ttf files (this directory should have been created for you during the installation process), run  xfstt -sync (which lets the server know about the fonts), then add the following line to your XF86Config file, near the end of the font-path section:

  Fontpath "unix/:7100"

I'm guessing that the "path" above is actually the port at which xfstt listens for font-requests from applications.

Once these tasks have been completed, shut down X and execute the backgrounded command  xfstt &, wait a few seconds, then restart X. The easiest way to try it out is to start Netscape, and in the Options->General Preferences->Fonts dialog scroll through your installed fonts and select one with (Ttf) appended to the font-name. Netscape showcases xfstt's capabilities due to the variety of font-sizes in many web-pages. The larger fonts in particular are much improved, without the jagginess they usually exhibit.

A little experimentation is needed to determine which of your applications can make use of these fonts. The Gimp will use them, but it already does a good job smoothing Postscript fonts, and I didn't see any great improvement using TrueType fonts. XEmacs will display scalable fonts, but I'd never used it for long with Postscript fonts due to X-induced scaling and rendering problems. The new TT fonts will be available from the Options menu and the improvement is remarkable.

Another use for this font server is as a supplier of window-manager title and menu fonts. A well-chosen font can really enhance the appearance of a desktop; I've tried this with fvwm2 and icewm, and I'm sure it would work with others. Lines such as these:

MenuStyle  gold darkslateblue bisque3 -ttf-americana-bold-r-*-*-12-*-*-*-*-*-*-* mwm

WindowFont   -ttf-americana-bold-r-*-*-14-*-*-*-*-*-*-*

(for fvwm2)should work. The -ttf- prefix of the font-specifier is the usual location of the font foundry name, such as Adobe or Bitstream.

According to the xfstt FAQ the StarOffice suite, the Xcoral editor, and Java can use these fonts, but I haven't tried them. The distribution includes a sample font.properties file for use with Java.

Possible Problems

The xfstt FAQ lists several problems people have had, mostly due to misconfiguration. The only one I've seen is not serious, but deserves mention. Once your XF86Config file has been modified (with the new Fontpath added) the xfstt server will need to be running first before X is started. If it's not running, X will fail to start, generating one of those classicly cryptic error messages X is so fond of:

  _FontTransSocketUNIXConnect: Can't connect: errno = 111
  _X11TransSocketUNIXConnect: Can't connect: errno = 111

Either xfstt will have to be started from the rc.init scripts (and thus be running constantly) or it can be manually started just before starting an X session. A shell script or alias could also be used to first start xfstt followed by X.

Other Implementations

Xfstt isn't the only way to use TT fonts in a Linux X session. Another project consists of a series of patches to the XFree86 source which will enable X's native font-server to provide TT fonts. Confusingly, the name of the project is xfsft. The home page of this effort is a good central site for other information on the web concerning TrueType fonts and Linux. It can be accessed here. A link on the page will take you to the FTP site where the patches can be found. The site also contains links to screen-shots of Netscape displaying TT fonts.

The Freetype project is yet another approach. It isn't an end-user application or server, but a library intended for use by programmers desiring to embed TT support in their applications; the project home-page is here.

Conclusions

According to Herbert Duerr (in the FAQ) TT fonts are particularly suited for display on low-resolution devices such as a computer monitor. Even though xfstt doesn't do any anti-aliasing of the fonts (since there's no support for this in X) nonetheless the fonts are displayed very clearly in all sizes. Unix traditionalists will stick with their tried-and-true fixed-width fonts, but users familiar with the font display properties of the various mswindows OS's might want to give xfstt a try. It sure works well for me!


Last modified: Wed 29 Apr 1998


Copyright © 1998, Larry Ayers
Published in Issue 28 of Linux Gazette, May 1998


[ TABLE OF CONTENTS ] [ FRONT PAGE ]  Back  Next