Diagnosing Font Problems

Note to those of you new to Linux: the GUI that greets your eyes in Linux is separate from the operating system itself. You can run Linux without it. This GUI is called officially XFree86, but is shortened to XF86 or just simply "X" in most cases. It has it's own configuration separate from the system, but nowadays it's treated as part of the standard setup.

The X server GUI is so complex that I wonder at times if there is any one person who really understands it. The factors in font display alone are so complicated I couldn't write a real triage -- "when you see this, check that." However, there are some common problems that I have read about and experienced myself. Most font display problems can be resolved by checking the following items. The order is based on my own experience.

1. The obvious: in KDE, check to see if Anti-aliasing is enabled -- Control Center > Appearance > Fonts. Checkmark all of the boxes first, then to see the result logout completely and log back in.

2. Make sure that the font server (xfs) is not running, unless you are working with a machine that serves fonts to other computers. The best way is to open YaST > Modules > System > Runlevel editor. In the window, with services displayed in alphabetical order, scroll down near the bottom and see if "xfs" is set to run by clicking on it. If it is, uncheck all the boxes for the various runlevels in the window frame just below the window, then click the "Finish" button.

A couple of years ago, the X server engines couldn't process TrueType fonts (TTFs) without help, so the font server was added externally. It was always crash-prone, and was a temporary fix at best. When XFree86 came out with the 4.x series, the code for handling TTFs was built in, and the font server became unnecessary for free standing systems.

3. Check to see that all the fonts have been installed properly. Any fonts you add after installing the system should be processed first by kfontinst: Control Center > System Admin > Font Installer (running as root, of course). Go to /usr/X11R6/lib/X11/fonts and see what folders are there. On my machine I have:

100dpi 75dpi CID Speedo Type1 URW encodings local misc truetype uni util

The fonts that matter most are in 100dpi and/or 75dpi, Type1, URW (which is a link to /usr/share/ghostscript/fonts), misc and truetype. Look inside each of these and see if there are actually fonts there.

Next, make sure each folder has the following files:

In earlier releases of SuSE, the bundled TrueType fonts -- Luxi -- were a problem, because SuSEconfig would consistenly pickup the contents of the extra fonts.scale.xf86 for the Luxi fonts, and wipe the listing for all the fonts you added later. That seems to have been fixed in SuSE 8.2, but if you notice that your fonts.dir is a copy of fonts.scale.xf86, and you have added TTFs, then rename that extra file to something like bak.fonts.scale.xf86 and rerun kfontinst by removing any single font, then adding it back in, and click "Apply." Since it will setup for all the fonts, including the Luxi fonts, the extra info in .xf86 file is unnecessary. You may find similar "features" in other distros.

As mentioned in the "Font Fight" HOWTO, make sure you have a valid fonts.scale by copying the fonts.dir to fonts.scale in each folder. Check this after running SuSEconfig, or when you run fonts-config.

4. Check to see if your font folders are listed in each of the following:

   /etc/X11/XF86Config
   /etc/fonts/fonts.conf
   /usr/X11R6/lib/X11/XftConfig

ALL the screen fonts on the system should be listed in XF86Config. The other two should have the critical fonts for display: 100dpi/75dpi, Type1, truetype, and misc. See "Font Fight" on the format for listing them in each config file.

5. Run fonts-config -f to get everything setup for Xft, then go back and replace the fonts.scale files. Finally, run fc-cache after everything is ready to go.

6. Consider compiling the freetype2 libraries, as it makes a tremendous difference for the display of TrueType fonts when not using Xft. The Xft anti-aliasing engine does not apply to anything under Gnome1 (for example: Evolution, Gvim, menus in Netscape 6 & 7 and Mozilla). It doesn't process fonts for anything that uses Motif (Netscape 4.x, Nedit, Xmcd, etc.) KDE allows you to turn off anti-aliasing, and this is better with some video cards and monitors. Gnome2 makes it extremely difficult to turn off anti-aliasing. Every other window manager or desktop display system benefits from the upgrade, too. Either way, with or without anti-aliasing, compiling your own freetype2 with byte-code hinting enabled will improve things dramatically.

7. Finally, be aware that some TTFs may be broken. Either they are poorly made, or they have been damaged in transfer. I copied mine directly from a WinXX machine using a floppy; the XP versions are best if you need lots of additional characters for foreign languages or symbols. They are available for download via YaST, as well. However you get them, things can be lost in transition, and you may have to try again.


The format for fonts.dir

Here is the first few lines from mine:

================================[snip]
1071
luximbi.ttf -b&h-Luxi Mono-bold-i-normal--0-0-0-0-m-0-adobe-standard
luximbi.ttf -b&h-Luxi Mono-bold-i-normal--0-0-0-0-m-0-iso10646-1
luximbi.ttf -b&h-Luxi Mono-bold-i-normal--0-0-0-0-m-0-iso8859-1
luximbi.ttf -b&h-Luxi Mono-bold-i-normal--0-0-0-0-m-0-iso8859-10
luximbi.ttf -b&h-Luxi Mono-bold-i-normal--0-0-0-0-m-0-iso8859-13
luximbi.ttf -b&h-Luxi Mono-bold-i-normal--0-0-0-0-m-0-iso8859-15
luximbi.ttf -b&h-Luxi Mono-bold-i-normal--0-0-0-0-m-0-iso8859-2
luximbi.ttf -b&h-Luxi Mono-bold-i-normal--0-0-0-0-m-0-iso8859-3
luximbi.ttf -b&h-Luxi Mono-bold-i-normal--0-0-0-0-m-0-iso8859-4
luximbi.ttf -b&h-Luxi Mono-bold-i-normal--0-0-0-0-m-0-iso8859-9
================================[snip]

That top line has the number of lines, NOT counting itself. First is the actual name of the font file as your system finds it: something.ttf. This means a TrueType font file (.ttf). The long line following shows the various bits of information about that file your system needs to know. This one is from the foundry (font-making company) B&H, and the font's fancy name "Luxi Mono." This particular font is the bold faced version with italic slant. It has a normal weight (not wide nor narrow, "medium" is about the same thing). The zeroes are not important here, but the end of each line shows an "encoding."

Depending on what language preference your system has, it will know it can choose this particular font and find a reasonable set of characters to match various language groups. Some applications prefer the old "adobe-standard" and some request unicode (iso10646-1) so that it's ready to display any number of characters found in the newest encoding standard. This standard lumps together every possible symbol for every language all over the earth, including some languages that are considered "dead." The files that meet this standard are huge, often running over 5MB each. Most fonts do not, but come reasonably close for most uses. Not many documents are written using Celtic Runes, for example (at least not yet), and not many of us will see a webpage written in Inuit ("Eskimo").


By Ed Hurst, updated 01 January 2004
This document released into the Public Domain.