xfsft: Truetype Font Support For X

This page presents a set of patches to make X11 support TrueType fonts. The patches can be compiled into an X server, or used to build a standalone font server which will provide TrueType support to any X11R5 or later X server.

Please note: This page is no longer being maintained. Xfsft has now been integrated with the main branch of XFree86 as the `freetype' module, and the standalone version is no longer current. Current versions of XFree86 include all the features of xfsft, and more. For more information, please consult the fonts.README document included with XFree86 4.0 and later.

As to my own web site, it has moved.

Table of contents:

The FreeType Library

The FreeType library is a free rasteriser for TrueType fonts. It should work on any machine with an ANSI C compiler -- no window system or particular OS is necessary. Bindings are provided for C and Pascal; as the library does not use callbacks, linking it with other languages should be easy.

You are invited to visit the FreeType project page.

The Xfsft patches

Some time ago, I took over from Mark Leisher the task of writing a set of patches to libfont.a -- the font backend of X11 -- to use the FreeType library to handle TrueType fonts. The patched libfont.a can be linked either with the X font server (xfs) or the X server itself and transparently allows all X applications to use TrueType fonts.


Here are some screenshots of common X applications running with TrueType fonts.

More screenshots are available from Jörg Pomnitz' xfsft page.

Status and features

Current versions seem very stable and portable.


Xfsft is distributed under the X11 license.

Does it do font smoothing?

This is a question that people keep asking me. The short answer is no.

Font smoothing, or anti-aliasing, is a technique used by some rasterisers to make fonts look better by using grayscale. Opinions differ on whether it actually makes fonts more legible, or more blurry, but it allows for sub-pixel positioning of glyphs, which can dramatically enhance the appearance of fully-justified text (the only program I know that takes advantage of this is Adobe Acrobat Reader, although Acorn RiscOS reportedly also does so).

Although FreeType does support font smoothing, the modified libfont.a does not. Adding font smoothing to X would require a major change to the system: in X, glyphs are (monochrome) bitmaps, and there is no support for using pixmaps as glyphs. Changing this would require the design and implementation of an extension to both the X protocol and the font server protocol, and changing applications to use the extensions.

(Since this was written, just such an extension has been designed and partly implemented.)

What are the alternatives?

Other than xfsft, there are at least two Free and a number of commercial servers handling TrueType fonts.

Xfstt can be found on TSFKA Sunsite in the directory Linux/X11/fonts. This was (as far as I know) the first Free TrueType rasteriser available, and is distributed under the Gnu Public License. It is written in C++, and has been entirely written by one person (Herbert Dürr): the TrueType rasteriser, the transport layer, and the interface between the two. This is an amazing feat.

Xfstt is very easy to use. In particular, it takes care of generating font directories (in its own format). It is also very easy to compile and install.

Unfortunately, xfstt is not quite compatible with other X font servers. In particular, it does not generate font properties, and differs from X11R6 in its interpretation of the attributes field of glyph metrics (attributes was undefined in earlier releases of X11).

X-TrueType has been designed with Japanese and other Ideographic scripts (Chinese, Korean) in mind.

There are a number of commercial offerings that provide TrueType to X11 systems. I have only tried one of these (don't ask, they don't pay me for advertising), and as far as I can tell without access to the sources, it seems okay.

Related information and links

The comp.fonts FAQ is unfortunately no longer maintained, but it is still a must read for anyone who wants to gain a basic understanding of fonts.

If you want to learn more about fonts under X11R6, you could read X Logical Font Description Conventions and eventually the introduction to The X Font Service Protocol which can both be found in the xc/doc subdirectory of the X11 distribution. You may also want to learn about the New Font Technology in X11R6, a paper by Nathan Meyers also available from WineHQ (Link to a PDF file.)

There is a Linux TrueType HOWTO in the works, which is by no means GNU/Linux-specific. Some information on Adding fonts to StarOffice, and Adding Fonts to ApplixWare.

Some of the encoding systems used: Unicode, codepoint-for-codepoint identical with ISO 10646, (see also Markus Kuhn's FAQ and ISO 8859 Roman Czyborra's Character Soup (also has information about the Koi encodings).

Strongly related to fonts, but still in alpha: a DPS extension for XFree86.

Somewhat off topic, but interesting, an interview with David Dawes, the best-beloved prez of the XFree86 project.

A note for users of the RedHat distribution of the GNU/Linux system

This section only applies to users of the RedHat distribution of the GNU/Linux system. Users of other systems or of other Linux-based distributions may want to skip to the next section.

In version 6.0, the RedHat distribution of the GNU/Linux system is shipped with a local version of XFree86 that is patched with xfsft 1.0.3p1 (the code is included both in the X server and the font server). Therefore, if you use this distribution, you do not need to separately install xfsft, unless you need the new features of the 1.1 branch. You may still want to download the source distribution of xfsft-1.0.3 and install the extra encoding files.

Unfortunately, the RedHat 6.0 distribution comes with a number of other local changes that make their version of XFree86 non-standard. In particular, in a somewhat simplistic attempt to make the system more secure, the font server is prevented from listening to TCP sockets (fonts can therefore only be served locally). Furthermore, the font server automatically forks and detaches itself from its controlling terminal, while the standard font server expects the invoking shell to fork it off.

For these reasons, you may want to stick to a standard version of the font server. If you do so, you will need to use a different version of the rc script used for invoking xfs; such a version is available either in the contrib directory of my FTP directory, or in the RPMs provided by Sarantos Kapidakis (see below).

Finally, there appears to be a bug in RedHat 6.0 (actually, in their version of the C library headers) that prevents XFree86 to be compiled for a 386 or 486 machine (compiling for 586 or later or for non-Intel systems should work fine). A workaround is to remove the flag -pedantic from the file xc/cf/xfree86.cf.

Please do not ask me to help you with configuring your RedHat system. (Or any other system, for that matter.)


Please note: Do not write to ask me to configure your system for you. Unless you're my boss, I won't answer.

Sources to the patches and font server binaries for Solaris 2/Sparc and GNU/Linux/Intel (Libc 6, Libc 5 for older versions) are available from

Important note: Building and usage instructions are in the source tarball. Please download the source tarball and read the usage instructions.

Note: You are strongly encouraged to use the ttmkfdir utility by Jörg Pomnitz together with Xfsft. You may find it at the first link below.

The binaries are statically linked with the FreeType library, which means that you will not need to compile your own version of the library.

The following binaries were not built by me, and I do not take any responsibility for them:

In order to build from sources, you will need the sources to libfont.a and xfs, which are part of the X11R6 distribution (I work with X11R6.3 fix 2). If you don't already have them, you can try your luck with XFree86 (not only for Intel systems) or The Open Group.

Juliusz Chroboczek.

Copyright © 1998-1999 by Juliusz Chroboczek

Permission is hereby granted, free of charge, to any person obtaining a copy of this material, to deal in it without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of this material, and to permit persons to whom this material is furnished to do so, subject to the following conditions: