Skip to content

Latest commit

 

History

History
38 lines (21 loc) · 2.73 KB

glyf1-cubicOutlines.md

File metadata and controls

38 lines (21 loc) · 2.73 KB

glyf—Glyf Data Table Format 1: Cubic-Bezier Outlines

The glyf data table (glyf) stores the glyph outline data. The format number for this table is stored in the head table's glyphDataFormat field. The only currently defined format of the glyf table is format 0. We propose format 1 of the glyf table to add multiple features. See full proposal for all features. In this proposal we cover: Cubic-Bezier Outlines.

In glyf table format 0, glyph outlines use quadratic Bezier curve segments.

In glyf table format 1, glyph outlines can mix quadratic and cubic Bezier curve segments.

Specification

Add the following flag to the Simple Glyph Description section's Simple Glyph Flags:

Mask Name Description
0x80 CUBIC Bit 7: Off-curve point belongs to a cubic-Bezier segment

Restrictions

Currently, there are several restrictions on how the CUBIC flag can be used. If any of the conditions below are not met, the behavior is undefined.

In the text below, wrap-around in a contour means whether the point after the last point of the contour is considered to be the first point of the contour, and symmetrically, the point before the first point of the contour is considered to be the last point of the contour. When we say "without wrap-around", no such consideration is made.

The number of consecutive cubic off-curve points within a contour, without wrap-around, must be even.

All the off-curve points between two on-curve points, with wrap-around, must either have the CUBIC flag clear, or have the CUBIC flag set.

The CUBIC flag must only be used on off-curve points. It is reserved and must be set to zero, for on-curve points.

Processing

Every successive two off-curve points that have the CUBIC bit set define a cubic Bezier segment. Within any consecutive set of cubic off-curve points within a contour, with wrap-around, an implied on-curve point is inserted at the mid-point between every second off-curve point and the next one.

If there are no on-curve points and all (even number of) off-curve points are CUBIC, the first off-curve point is considered the first control-point of a cubic-Bezier, and implied on-curve points are inserted between the every second point and the next one as usual.

As in the glyf version 0 table, an implied on-curve point is inserted between any two neighboring quadratic off-curve points.

Hinting

Hinting works exactly the same for quadratic-in-glyf, with points addressed by index number.