O'Reilly logo

Fonts & Encodings by Yannis Haralambous

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 13. Optimizing a Rasterization

In a world peopled with fonts, we would read in Genesis: "for pixels thou art, and unto pixels thou shalt return". Indeed, we often forget that the ultimate goal of all the mathematical constructions that represent our glyph outlines is to produce images made from pixels. If we had only one font size and only one resolution for our screens and printers, we would have no need of outlines; the bitmaps would be quite sufficient. Outlines exist only to allow fonts to be adapted to the current situation and produce an adequate bitmap on the fly.

The process of moving from the "vector outline" state to the "bitmap" state is called rasterization. It is a crucial process because the final appearance of the text depends on it.

To understand the value of this chapter, we must examine how rasterization is done. Since pixels are—fortunately—equidistant, we can imagine that beneath the geometrically perfect outline of a glyph there is a grid each of whose squares has the size of one pixel. Then rasterization involves filling in some of the squares of this grid to obtain as faithful an approximation to the glyph's outline as possible. Some of the squares—yes, but which ones? Therein lies the problem.

We can adopt a methodical approach: for example, we can say that we shall fill in any pixel whose center lies inside the outline (or on the outline). This method is very fragile: sometimes a very slight difference in an outline is enough to make the centers ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required