|This article needs additional citations for verification. (November 2009)|
Font rasterization is the process of converting text from a vector description (as found in scalable fonts such as TrueType fonts) to a raster or bitmap description. This often involves some anti-aliasing on screen text to make it smoother and easier to read. It may also involve hinting—information embedded in the font data that optimizes rendering details for particular character sizes.
Types of rasterization
In modern operating systems, rasterization is normally provided by a shared library common to many applications. Such a shared library may be built into the operating system or the desktop environment, or may be added later. In principle, each application may use a different font rasterization library, but in practice most systems attempt to standardize on a single library.
In older systems and in some embedded systems, fonts are represented as bitmaps pre-drawn at specific sizes. However, most modern systems use fonts represented as mathematical primitives, allowing arbitrary scalability.
The simplest form of rasterization is simple line-drawing with no anti-aliasing of any sort. This is the fastest method (that is, it requires the least computation to place on screen). This approach has the disadvantage that glyphs may lose definition at small sizes. Therefore, many font data files contain hints that help the system's rasterizer decide where to render pixels for particularly troublesome areas in the glyphs, or sets of hand-tweaked bitmaps to use at specific pixel sizes.
A more complicated approach is to use standard anti-aliasing techniques from computer graphics. This can be thought of as determining, for each pixel at the edges of the character, how much of that pixel the character occupies, and drawing that pixel with that degree of opacity. For example, when drawing a black letter on a white background, if a pixel ideally should be half filled (perhaps by a diagonal line from corner to corner) it is drawn 50% gray. Over-simple application of this procedure can produce blurry glyphs. For example, if the letter includes a vertical line that should be one pixel wide but falls exactly between two pixels, it appears on screen as a two-pixel-wide gray line. This blurriness trades clarity for accuracy. However, modern systems often force lines to fall within integral pixel coordinates, which makes glyphs look sharper, but also makes lines slightly wider or thinner than they would have looked on a printed sheet of paper.
Most computer displays have pixels made up of multiple subpixels (typically one each for red, green, and blue, which are combined to produce the full range of colours). In some cases, particularly with flat panel displays, it is possible to exploit this by rendering at the subpixel resolution rather than using whole pixels, which can increase the effective resolution of the screen. This is generally known as subpixel rendering. One proprietary implementation of subpixel rendering is Microsoft's ClearType.
Currently used rasterization systems
Microsoft Windows has supported subpixel rendering since Windows XP. The Windows rasterizer is an example of one that prioritizes clarity; by forcing text into integral coordinate positions (and not even antialiasing certain fonts at certain sizes), it becomes easier to read on the screen, but may appear somewhat different when printed.
Mac OS X's Quartz is distinguished by the use of floating-point positioning; it does not force glyphs into exact pixel locations, instead using various antialiasing techniques, including subpixel rendering, to position characters and lines to appear closer to the typographer's intent. The result is that the on-screen display looks extremely similar to printed output, but can occasionally be difficult to read at smaller point sizes. Contrary to other rasterizers, Quartz ignores any Postscript or TrueType hints in the font and solely relies on its own algorithm. A simpler type of font antialiasing was introduced in Mac OS 8.5, in 1998. Apple's technique can be seen on Windows in older versions of Safari for Windows. In more recent versions, however, Apple has switched to using system settings by default.
RISC OS includes font anti-aliasing, first introduced before January 1989. It uses its own font rendering system, which favours accurate shapes over readability, with features such as scaffolding and hinting, sub-pixel positioning and background blending.
Most other systems use the FreeType library, which falls somewhere between Microsoft's and Apple's implementations; it supports hinting and anti-aliasing, and optionally performs subpixel rendering. The Free fonts included with most Linux distributions look better with FreeType's "auto-hinting" mode, which is high-quality and not encumbered by patents.
D-Type Font Engine is an independent, proprietary and portable font rasterization library. It provides anti-aliasing, subpixel precision, automatic hinting, bitmap filtering and other techniques that can improve the appearance and legibility of text on screen. According to the authors, the display quality of D-Type Font Engine can be configured to match or exceed the quality of Windows and Mac OS X font rasterizers while using only non-hinted TrueType, OpenType or Type 1 fonts.
- "A Treatise on Font Rasterisation With an Emphasis on Free Software". freddie.witherden.org. 2009-12-29. Retrieved 2010-09-12.
- Pountain, Dick (1988-12). "Screentest: Archie RISC OS". Personal Computer World. p. 154. Retrieved 2011-01-14. "[ArcDraw] can also add text in multiple sizes and fonts to a drawing (including anti-aliased fonts)"
- "Mike's Homepage - Words - Thoughts - RISC OS". Mikejs.com. 2006-12-07. Retrieved 2009-11-10.
- "D-Type - Font Engine and Rasterizer". d-type.com. 2003-12-24. Retrieved 2009-11-30.
- "D-Type - Font Engine and Rasterizer - Examples". d-type.com. 2003-12-24. Retrieved 2009-11-30.