Wednesday, October 13, 2010
The way a font looks on screen is determined by the system’s rasterizer, an indispensable piece of software which produces the bitmaps we view on screen or in print.
Fonts can be stored as bitmaps, outlines or strokes. Each format has its pros and cons, which we will discuss in future issues, but all of them are ultimately rendered as a bitmap.
Bitmaps can also be grayscale or even color. The number of shades of gray or number of colors in a bitmap is referred to as the bit depth. In the case of stroke or outline fonts, the data can be interpreted by the rasterizer to produce bitmaps at an effectively infinite number of sizes, bit depths and orientations.
Scalable Outline Format
The outline of each glyph is stored as a series of coordinates that, when connected by lines and curves, produce the shape of the letter in question. OpenType fonts can have their glyphs described with either cubic beziers (Postscript CFF) or quadratic beziers (TrueType) which use different mathematical descriptions of their curves. But the idea remains the same: a series of connected points define the idealized shape of each letter.
These coordinates are scaled to the desired size for rendering. Type size is typically expressed in printers’ points. While point size is useful for typographers and graphic designers, it does not communicate the resolution of the rendering device, and so a more precise unit of measurement is what we call pixels per em, or ppem. This resolution-independent value defines the number of device pixels within the point size of the font. One can envision the scaled outline as being drawn on tracing paper, laid over graph paper, where the squares produced by lines on the graph paper represent the pixels of the device. The height of the point size in pixels is the scaled ppem size.
Once an outline is scaled to the desired target size, a bitmap could be created by simply filling in pixels which reside within the glyph outline. This process of filling pixels is called scan conversion. One of the simplest scan conversion algorithms is to turn a pixel “on” if its center resides within the confines of the glyph outline. This very simple method produces adequate results at large sizes, or with very high resolution, but it is inadequate for low resolution environments like a desktop or mobile screen.
Font Rasterizers in the Wild
There are many different rasterizers in use today, and each of them is unique in some way from all the others. As the inventors of TrueType, Apple delivered the first TrueType rasterizer with Macintosh System 7 in 1991. In an effort to make TrueType the standard font format, they licensed TrueType to Microsoft and other font foundries. However, even the first port of Apple’s code to Windows 3.1 resulted in small differences. The differences have only increased with time, and so it is a significant challenge to produce a font which renders the same pixels in multiple environments. Matters are complicated further now that OpenType is the defacto standard, as OpenType can support either TrueType or PostScript style outline data, and thus each rasterizer has two main code bases to support these different sub-formats.
On-Screen Legibility (hinting)
Fonts for User Interfaces