Troubleshooters.Com and T.C Linux Library Present

Fixing Those Unreadable Cookie Crumb Fonts

Copyright (C) 2001 by Steve Litt
[ Linux Library | Troubleshooters.Com | Email Steve Litt | Copyright Notice ]

Contents:

Executive Summary

The purpose of this document is to give you readable fonts with XFree86 version 4 and better. Making your fonts as pretty, scalable or anti-aliased is beyond the scope of this document. Using TrueType fonts in Linux is also beyond the scope of this document, although this doc contains the info necessary to render TrueType fonts with readable substitute fonts in a browser.

If your goal is easily readable fonts in applications, documents and browsers, using XFree86 version 4 or better, this document gives you what you want.

Disclaimer

Obviously, you use this document at your own risk. But beyond that, this document is based on about three days of study on my part. Three days does not an expert make. I'm sure there are mistakes in this document. Please email me at Steve Litt's email address to tell me of any mistakes you find.

You can find more authoritative information at the Linux Documentation Project.

So why did I write this document?

Why did I write this admittedly non-authoritative document that likely contains mistakes, instead of just pointing to the LDP font documents and other font documents?

This document was written because the authoritative documents are incredibly complex, dealing with all sorts of variables. Unless you're a font expert, it will take you days of experimentation to understand all the variables discussed in the authoritative documents.

This document was written to provide a quick and easy fix to a very common syndrome -- where certain web pages render with unreadable fonts. This syndrome is extremely common with Mandrake 8.0 installations using XFree86 version 4. The solution involves a slight edit to one file, and possibly installing one set of fonts.

What About Truetype, Scaling, Anti-aliasing, and Professional Publishing?

If you want your fonts to be pretty, scalable, anti-aliased, or fit for professional publishing, see the LDP Font De Uglification mini-howto at http://www.linuxdoc.org/HOWTO/mini/FDU/index.html, as well as the Font Howto at http://www.linuxdoc.org/HOWTO/Font-HOWTO.html.

If your goal is limited to easily readable fonts, the current document suits your needs (and if it doesn't, email Steve Litt's email address.

Font Myths

There's a myth that the "right" way to do Linux fonts, especially with Red Hat derived distributions, is with the xfs font server. That may have been true using XFree86 version 3 and below, but not version 4.

Version 4 uses technology from the xfsft font server in order to render Truetype fonts, and also some support for anti-aliasing.

What this means is that XFree86 version 4 gives you everything that the xfs font server gave you, except the ability to serve fonts to other computers. So unless you are serving fonts to other computers, xfs is unnecessary. I quote from the Font DeUglification Mini-Howto at http://www.linuxdoc.org/HOWTO/mini/FDU/index.html:

"A separate font server is no longer needed just for TrueType support. You may disable it, unless it is needed to serve fonts to other clients in a network environment."

Not only is xfs unnecessary, but it seems to conflict terribly with XFree86 version 4, at least on the Mandrake Linux version 8 distribution. In fact, it creates many fonts that look like crumbling cookies. These fonts are unreadable at small or moderate point sizes, and hideously ugly at large point sizes. These fonts often lose the pieces of characters necessary to distinquish one from another.

The Key Distinction, xfs

There are hundreds of interdependent variables involved with font rendering, but the one variable that can toggle crumbly fonts on and off is this line in XF86Config-4:
FontPath "unix/:-1"
If that line is commented out, your crumbly fonts become legible. Uncomment it and they become illegible. What this line does is invoke the xfs font server to render fonts. If you comment it out XFree86 version 4 renders the fonts much more nicely, using its xfsft technology. If it doesn't bomb...

Replacing the xfs Fonts

In the Mandrake 8 distribution (and probably others), the only FontPath is the offending one:
FontPath "unix/:-1"

Caution:

Edits to XF86Config-4 do not take effect until X is stopped and started. After closing all apps accessing open files, from the taskbar start menu simply choose "logout", or simply press the Ctrl+Alt+Backspace keystroke combination.


Simply commenting that line leaves NO font paths, which prevents X from running. X must have a minimum of fonts to run. I've found that adding four lines above the now commented "unix/:-1" line enables X to run, and provides properly sized, readable fonts in a wide variety of circumstances, including windows, taskbars, menu bars and menus, browser contents, and office products (with exceptions). The four lines to be added to XF86Config-4 are as follows:

FontPath        "/usr/X11R6/lib/X11/fonts/misc:unscaled"
FontPath        "/usr/X11R6/lib/X11/fonts/75dpi:unscaled"
FontPath        "/usr/X11R6/lib/X11/fonts/100dpi:unscaled"
FontPath        "/usr/X11R6/lib/X11/fonts/mozilla-fonts"
FontPath lines are read in order, so that the first one with a font matching that requested is chosen. Thus the preceding configuration first looks for a 75dpi font, and then if not found looks for a 100dpi one. That's best for 800x600 and below, but 75dpi fonts would render too small on 1024x768 and above, so at those resolutions you should swap the 75dpi and 100dpi lines. However,  if most of your dialog boxes render so big that you can't see the buttons, or if Netscape's menu bar printing is obnoxiously huge, make sure that 75dpi comes first.

There's a reason mozilla-fonts is at the bottom. Mozilla fonts are way too big (you could fix that by tweaking their font.alias file if you have the guts).  By running ordinary fonts first, you get normal fonts most of the time, but if a font slips through the first 3, it's rendered quite nicely as a mozilla-font.

On Mandrake 8 boxes, the Mozilla fonts are in the directory described by the last of the four preceding lines. On other distributions they might be in a different place. In that case change the FontPath line to describe their location. If Mozilla fonts are not installed, install them either via an RPM or .deb on your distro, or by installing them as per download instructions.

This goes for all the other lines too. Make sure all your FontPath lines point to legitimate directories containing fonts and a fonts.dir file.

Restart X (with startx or however you usually start it), and your fonts should be much better.

Tips on Font Choice

Helvetica renders the best at all sizes and resolutions, but most people prefer a serif'd font for body text.

When you want serifs, if possible choose new century schoolbook. It's MUCH clearer than all vendors' implementation of the times font, especially at smaller sizes. In some applications (StarOffice is an example) times can render horribly. Note, however, that in StarOffice times prints just fine on paper, and that spacing on the paper copy matches spacing on the screen.

Never use mozilla-fonts for anything but browser contents. They're huge and contain huge gaps in their point size choices. There's no 7point bold, and 9 point bold renders like <h3> in html.

Many apps (Netscape comes to mind) have no config for their menubar font, and just use their hardcoded choice out of 75dpi or 100dpi. That's a major reason you don't use 100dpi below 1024x768. If your Netscape menu bar is way too huge, make sure 75dpi comes first in XF86Config-4.

Summary

This document presents a simple solution to the common syndrome of cookie crumb fonts, especially noticed on browsers with XFree86 version 4, and commonly observed on the Mandrake 8 distribution. The cause is the xfs font server, and the solution is to disable that server by commenting out the following line from XF86Config-4:
FontPath "unix/:-1"
Now that the font server is gone, you must give XFree86 some fonts to work with, so substitute the following lines for the one you commented out:
FontPath        "/usr/X11R6/lib/X11/fonts/misc:unscaled"
FontPath        "/usr/X11R6/lib/X11/fonts/75dpi:unscaled"
FontPath        "/usr/X11R6/lib/X11/fonts/100dpi:unscaled"
FontPath        "/usr/X11R6/lib/X11/fonts/mozilla-fonts"
Then restart X, and watch your fonts get readable.

This document also contains font choice tips, including choosing New Century Schoolbook rather than Times. This document does not discuss TrueType, anti-aliasing, font scaling or pretty fonts, because those involve a lot of variables and a lot of configuration. Once your fonts are readable, you might want to make them pretty by following the instructions in the Linux Documentation Project pages at:

http://www.linuxdoc.org/HOWTO/mini/FDU/index.html,: LDP Font De Uglification mini-howto
http://www.linuxdoc.org/HOWTO/Font-HOWTO.html.: Font Howto


See also: [ Linux Library | Troubleshooters.Com | Email Steve Litt | Copyright Notice ]

Copyright (C)2000-2001 by Steve Litt. -- Legal