Gray Scale Font Rasterization

Render smooth and sharp glyphs

The TrueType rasterizer now supports gray scale scan conversion, an anti-aliasing technique that uses gradated values of gray to smooth the jagged edges of bitmap shapes. Gray scale is most effective when bitmaps are displayed on screens at small sizes and coarse resolutions.

For added control over glyph rasterizing, a new TrueType table, called 'gasp' (for Grid-fitting and Scan Conversion Procedure), defines the best combinations of hinting and gray scale to apply at different font sizes. Hinting preserves the design characteristics of a typeface and it corrects font scaling defects, such as uneven stroke widths and curve asymmetries, usually by constraining the control point extrema of contour glyph shapes to the pixel grid before scan conversion. When hinting is combined with gray scale rendering, the rasterizer applies gray values only to the contour shape edges that do not align with the pixel grid, such as curved and diagonal edges. Horizontal and vertical edges that do align with the pixel grid remain black to retain image sharpness.

The 'gasp' table specifies up to eight pixel-per-em (ppem) size ranges and the combination of hinting and gray scale operations to apply within each range. Ranges may require different rasterization actions. For example, at very small screen sizes, gray scale scan conversion, without hinting, produces the best appearance. At intermediate screen sizes (10 to 12 points), hinting generates high quality text, without the use of gray scale. And, at large screen sizes, a combination of hinting and gray scale scan conversion is optimal.

Windows 95 uses a scale of five gray values to generate a gray scale glyph: black, white, and three intermediate grays. The gray scale scan converter determines the specific value of gray to apply to a pixel by calculating the extent of the glyph's contour that falls within the pixel's boundaries. If a small percentage of the contour lies within a pixel, then the pixel's color is light gray; conversely, if a large percentage of the contour falls within a pixel, then the pixel's color is dark gray. The rasterizer applies this gray scale blending technique to other foreground and background text colors on some display devices.

Gray scale rasterization is applied only to contour glyph shapes; currently, there is no support for storing an embedded gray scale bitmap or for generating a gray scale bitmap from a monochrome bitmap. If a specific glyph is selected for display at a particular size, and gray scale is requested, then the TrueType rasterizer will generate a gray scale bitmap directly from the glyph contour data, even if an embedded bitmap exists at the requested size.