Created
November 12, 2018 20:11
-
-
Save davelab6/fb0783aaef3afbe40a322b70be4daa43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GLYPH DATA | |
========== | |
- Glyph flag | |
- Metric data | |
- Outline data | |
- Extra data segments | |
OUTLINE DATA | |
============ | |
Outline data of a glyph is recorded in this manner: | |
- Length of items (points and inclusions) | |
- Number of VF tuples | |
- Item flags | |
- Static dX | |
- Static dY | |
- Variable deltas | |
- Contour mask (optional, decided by glyph flag) | |
Item flag list: One byte for each glyph item (point OR inclusion) | |
- Points : 0 . . . . . . . | |
- --- --- --- | |
S ZT XT YT | |
- S : Start of a contour; | |
- ZT : Point type | |
- 00 : On knot | |
- 01 : Quadratic off knot | |
- 10 : Leading cubic off-knot | |
- 11 : Trailing cubic off-knot | |
- XT & YT : Coordinate type of static outline | |
- 00 : Zero | |
- 01 : Short integer | |
- 10 : Positive byte or Fraction | |
- 11 : Negative byte or Fraction | |
- Includes : 1 . . . . . . . | |
- --- --- --- | |
G R XT YT | |
- G : Include a glyph rather than a fragment | |
- R : Reserved (for rounding and hinting?) | |
Including a glyph or a fragment into the font. Inclusion simply | |
copies outline data of the part being included, with an extra X | |
and Y shift being added into it. The X and Y shift could be | |
polymorphic, and they are added to all the touched points in the | |
included component. | |
Static dX and dY coordinate: | |
- For points, depending on the XT or YT: | |
- For XT/YT = 00, the data is not needed. | |
- For XT/YT = 01, the data is two bytes long and represents a big-endian | |
signed short. | |
- For XT/YT = 10 or 11, the data is interpreted as this: | |
Let c be the result of read one byte. | |
if c != 0 then | |
return (XT/YT == 10) ? c : -c | |
else | |
let f = read four bytes and decode it as a unsigned Q16.16 | |
return (XT/YT == 10) ? f : -f | |
- For inclusion, there would always two bytes for dX, representing the ID of | |
the componet being included; There could be an extra shift value, and its | |
form is defined by the XT/YT. | |
Variable X and Y deltas: | |
- Use the current GVAR mechanism. For each tuple, untouched points are | |
interpolated with an IUP. | |
Contour Mask: | |
- A bit field to describe whether a contour would be disabled during | |
rasterization. Useful for color glyphs. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment