User Guide

Hinting
479
Co o r di na t e R o u ndi ng, Gr i dfi t t i ng
Output devices take the vector outline of a glyph and “rasterize” it. That is,
they calculate from the outline data where they need to place each pixel to
get an accurate output representation of the glyph. Since the final output is
on a discrete raster (i.e. a grid of numbered pixels), the scaled pixel
coordinates need to be rounded somehow to integer values.
For example, if you have an outline point with coordinates (120, 100) and scale it down 7 times, you
will get the coordinates (17.1429, 14.2857). After rounding to the closest integer values, the
resulting coordinates will be (17, 14) and so the rounding error will be 0.1429 (0.84%) pixels for the
horizontal coordinate and 0.2857 (2%) for the vertical coordinate. If we instead scale this point
down 13 times, then the scaling errors will be 2.5% for the vertical coordinate and 3.8% for the
horizontal coordinate. You can see that the rounding error increases as the size of the final outline is
reduced.
Rounding error
To minimize rounding errors font rasterizers use special algorithms that
slightly change the scaled outlines to get better results on devices with low
and medium resolution. This process is called gridfitting. Algorithms that
gridfit outlines use additional information stored with an outline’s
definition. These instructions are referred to as hints. Hints usually define
the most important proportions of characters, the positions of critical
elements of characters, and a set of rules for outline modification.
For perfect-looking fonts it’s not enough to define the characters' outlines,
you must also provide hints. The process of specifying the hints is quaintly
called hinting.