X11 & TrueType fonts

This document describes how to use TrueType fonts on an X11 server. Recent versions of X11 have TrueType support build in. For those with older X11 versions, and not willing to recompile X11, an easy and quick solution is to convert TrueType fonts to X11 bitmap fonts.

Many TrueType fonts look better than most standard X11 fonts. Especially Web documents will often improve dramatically in legibility when TrueType fonts are available.

What you need

The FreeType libraries and the ttf2bdf utility, available at:
http://www.freetype.org/
Mapping tables for ttf2bdf, such as:
iso8859.1
iso8859.15
A script to create all X11 bitmap fonts:
TTFall

Mapping tables

The mapping tables define what characters, at what positions, are to be used in the bitmap font files.

The tables provided here are for Latin1 (iso-8859-1) and Latin 9 (iso-8859-15). Latin9 is intended as a replacement for Latin1. It contains the Euro symbol, and some other important European characters missing in Latin1. See differences between Latin1 and Latin9. If you don't have TrueType fonts with the Euro sign, you can download free updates from Microsoft.

The mapping tables provided here also contain mappings for the line drawing elements, needed for programs such as the Midnight Commander. These mappings are missing in the tables distributed with ttf2bdf.

TTFall

The script TTFall converts all available TrueType fonts into X11 bitmap fonts. Follow these steps:

  1. Create a directory to put the new bitmap fonts, such as /usr/X11R6/lib/X11/fonts/ttf2pcf, and add this directory to the configuration of your X11 (font) server.
  2. Put the files iso8859.1 and iso8859.15 in /usr/local/lib/ttf2bdf, or modify TTFall to look for these files in a different location.
  3. Check TTFall for the correct location of the TrueType fonts.
  4. Run TTFall in the new font directory to create all bitmap fonts.
  5. Run mkfontdir.
  6. Restart X11 (font) server.

Some comments on TTFall

The program ttf2bdf doesn't recognize fonts as mono-spaced. The script TTFall assumes the following fonts are mono-spaced:

    cour*|lucon*|ocraext*|andale*
If you have more mono-spaced fonts, modify TTFall.

The script creates fonts for iso-8859-1 and iso-8859-15:

    for ENC in 1 15

Modify the script to use other encodings. Also, some TrueType fonts may not have all the necessary fonts for iso-8859-15, such as the Euro. You may choose to remove these bitmaps with incomplete encoding, after running TTFall.

The script creates fonts with these sizes:

    for i in 10 12 14 18 24
Usually, X11 fonts contain fonts in size 8. But you may wish to remove these, or Web documents asking for <font size="1"> may be illegible.