The Importance of Font Implementations

Broadly speaking, there are two types of fonts:

Bitmap Fonts These fonts are described in terms of individual pixels in an array of pixels. For instance, Figure 16.2 shows a bitmap representation of the letter A. Bitmap fonts must be hand-drawn for every combination of text size and display resolution, which makes them inflexible. If a font isn't available in the right size, it won't be displayed or it will be scaled in a way that makes it look chunky. On the other hand, these fonts tend to be quick to draw, because they can be copied from memory to the display with little computation required. The fact that they're hand-drawn for specific resolutions also tends to make them look good at low resolutions because a human artist can optimize them for particular sizes. Many bitmap font formats are available, and X can handle many of them.

Figure 16.2: A bitmap font is built from individual pixels that may be either on or off.

Outline Fonts These fonts are built from mathematical descriptions of their outlines, using lines and curves. A font rastehzer(a component of X or some other program) can then create a bitmap for display at any resolution. This feature makes outline fonts very flexible, but they take more CPU time to display. They frequently don't look as good at screen resolutions as do bitmap fonts, because font rasterizers tend to be aesthetically challenged compared to human artists. The two most popular outline font formats are Adobe's PostScript Type 1 (aka Adobe Type Manager, or ATM) and Apple's TrueType. Both formats are supported by XFree86, although TrueType support was added recently, with XFree86 4.0.

X ships with a modest assortment of bitmap fonts designed for both 75 dots per inch (dpi) and 100dpi displays. These fonts tend to look fairly good at the specified resolutions, but not nearly as good at other resolutions. All Linux distributions also ship with a wider assortment of outline fonts, mostly in Type 1 and TrueType format.

Note Technically speaking, a font is a set of characters rendered at a specific size and (for computers) resolution. In common use, though, the word font often refers to outline formats or a collection of bitmap fonts that work at several sizes—a meaning that better matches the term typeface. In this book, I use the word font in this less accurate but more popular sense.

Most fonts you find on the Internet or on font CDs are in Type 1 or TrueType format. Type 1 fonts come as collections in several files. The most important of these are .pfb or .pfa files, which hold the font data proper; and .pfm or .afm files, which hold detailed information on the spacing between individual letters. X needs the .pfb or .pfa files but not the .pfm or .afm files. Some applications, such as some word processors, need these latter files, though. TrueType fonts come as single files with .ttf extensions.

TrueType fonts have acquired a reputation for looking good at screen resolutions; however, this reputation is due in part to the fact that a few popular TrueType fonts are very well designed. These exemplary fonts include extensive hinting—information embedded in the font on how to tweak the font display at low resolution. In particular, many of the fonts that Microsoft includes with its products are very well designed. When you use a randomly selected font from elsewhere, the TrueType version might or might not look any better than the Type 1 version.

The quality of the font rasterizer is also very important in determining the appearance of a font. Part of the reason for the historical complaints about Linux's font quality is that XFree86's Type 1 font rasterizers have not been the best. This situation is improving, though, particularly with new font libraries that handle font smoothing.

Fonts typically come in families. For instance, many fonts come in normal or Roman styles intended for most body text, along with an italic variant, a bold version, and a bold-italic version. Some fonts come with more variants, such as several gradations of boldness, narrow variants, and so on. Some programs can fake one or more of these styles using the normal variant, but the results are almost always superior if you use a custom font for each style. As a result, installing "a" font may actually require installing several fonts, one for each style.

0 0

Post a comment