TrueType Outlines | |
IntroductionThere are two key aspects that characterize the various outline font technologies: curve representation and hinting. TrueType hinting is discussed elsewhere. This page describes TrueType outlines.The Mathematics of TrueType CurvesTrueType's curves are quadratic B-splines. Each spline is equivalent to a series of quadratic Bézier curves. And each of these is defined by 3 outline control points, rendered by a parametric, quadratic equation hard-coded into the rasterizer.If the 3 points of each Bézier curve are (Ax, Ay), (Bx, By) and (Cx, Cy), then
px = (1-t)2.Ax + 2t(1-t).Bx + t2.Cx Varying the parameter t from 0 to 1 produces all the points p on the curve defined by A, B and C. Visually, the curve runs between the two on-curve control points A and C, using the off-curve control point B to "pull" the curve in its direction. The curve is such that it leaves A along the straight line AB, and enters C along the straight line BC. (This property of the curves means that tangents are easy to define in TrueType.)
The letter 'b' of Monotype Arial. In Figure 1, the points numbered 4, 5 and 6 correspond to the A, B and C of the above equations, and together define a section of the glyph outline. Where multiple off-curve points occur consecutively, an on-curve point is interpolated exactly half-way between them. Thus there is an implied on-curve point between points 7 and 8, between points 8 and 9, and so on. The curve running from point 6 to point 11 is a single quadratic B-spline, decomposed to 4 quadratic Bézier curves in the rasterizer. Glyphs are defined as a series of contours, each of which contains three or more points. Each point is either on-curve or off-curve. Contours can even consist entirely of off-curve points.
Solid to the right
Badly-behaved outlines The Format of TrueType Outline DataOutlines for all the glyphs in a font are stored in TrueType's 'glyf' table. The format is described with extreme conciseness, in just over 4 pages of the TrueType specification. This table, containing all the glyphs in order, is indexed by the 'loca' table.
There are three kinds of glyph in TrueType: simple, composite and zero-contour...
See also
TYPE*chimérique | TrueType Typography | TYPE*links |