The GDEF table describes glyphs for the layout tables: which glyphs are
bases, ligatures and marks, where carets go inside ligatures, how marks are grouped, and,
in variable fonts, the variation data that GPOS and JSTF values
refer to. Its parts are independent and each is optional. All numbers are big-endian.
Header
| Offset | Type | Name | Version | Description |
|---|---|---|---|---|
0 | uint16 | majorVersion | all | 1. |
2 | uint16 | minorVersion | all | 0, 2 or 3. |
4 | Offset16 | glyphClassDefOffset | 1.0 | Glyph classes, or NULL. |
6 | Offset16 | attachListOffset | 1.0 | Attachment points, or NULL. |
8 | Offset16 | ligCaretListOffset | 1.0 | Ligature carets, or NULL. |
10 | Offset16 | markAttachClassDefOffset | 1.0 | Mark attachment classes, or NULL. |
12 | Offset16 | markGlyphSetsDefOffset | 1.2 | Mark glyph sets, or NULL. |
14 | Offset32 | itemVarStoreOffset | 1.3 | Item variation store, or NULL. |
Offsets count from the start of GDEF. The header is 12, 14 or 18 bytes
for versions 1.0, 1.2 and 1.3.
Glyph classes
A ClassDef table with these classes. Glyphs not listed are class 0, unclassified.
| Class | Meaning |
|---|---|
| 1 | Base glyph: one character, takes up space. |
| 2 | Ligature glyph: several characters, takes up space. |
| 3 | Mark glyph: a combining mark that takes no space. |
| 4 | Component glyph: part of one character, used to build ligatures; no GSUB or GPOS format refers to this class. |
The lookup flags that ignore bases, ligatures or marks rely on these classes; without them, software has to classify glyphs itself.
Attachment point list
Lists the outline points of each glyph that GPOS attaches to, so they can be cached with rendered glyphs.
| Structure | Type | Name | Description |
|---|---|---|---|
| AttachList | Offset16 | coverageOffset | Glyphs with attachment points, from the start of the AttachList. |
uint16 | glyphCount | Number of glyphs. | |
Offset16 × count | attachPointOffsets | One AttachPoint per glyph, by Coverage Index, from the start of the AttachList. | |
| AttachPoint | uint16 | pointCount | Number of points. |
uint16 × count | pointIndices | Contour point numbers, in increasing order. |
Ligature caret list
Where to put the text cursor between the components of a ligature, so a user can select part of it. A value is an x coordinate in horizontal text and a y coordinate in vertical text.
| Structure | Type | Name | Description |
|---|---|---|---|
| LigCaretList | Offset16 | coverageOffset | Ligature glyphs, from the start of the LigCaretList. |
uint16 | ligGlyphCount | Number of ligatures. | |
Offset16 × count | ligGlyphOffsets | One LigGlyph per ligature, by Coverage Index. | |
| LigGlyph | uint16 | caretCount | Number of carets: components − 1. |
Offset16 × count | caretValueOffsets | Caret values in increasing coordinate order, from the start of the LigGlyph. |
| CaretValue format | Fields after uint16 format | Meaning |
|---|---|---|
| 1 | int16 coordinate | A position in design units. |
| 2 | uint16 caretValuePointIndex | A contour point of the glyph, whose position after hinting gives the caret. |
| 3 | int16 coordinate, Offset16 deviceOffset | A position plus a Device table (other fonts) or VariationIndex table (variable fonts), from the start of the CaretValue. Variable fonts must use this format for carets that vary. |
Mark attachment classes
A ClassDef table that groups marks, for example top marks as class 1 and bottom marks
as class 2. A lookup whose flags name a mark attachment class (bits 8 to 15 of
lookupFlag)
skips marks of every other class. A mark has one attachment class.
Mark glyph sets
| Type | Name | Description |
|---|---|---|
uint16 | format | 1. |
uint16 | markGlyphSetCount | Number of sets. |
Offset32 × count | coverageOffsets | A Coverage table per set, from the start of this table. Note the 32-bit offsets. |
Sets do the same job as attachment classes but may overlap. A lookup with
USE_MARK_FILTERING_SET names one set by index in its
markFilteringSet field; only one set or class can be used per lookup.
Item variation store
In variable fonts, the one item variation store for the layout tables: deltas for
GDEF carets and for GPOS and JSTF values, in
any arrangement. Values that vary point to a VariationIndex table (outer and inner
index into this store) where other fonts would have a Device table, so variable fonts
cannot use Device tables. Software without variation support, or a font that is not
variable, ignores VariationIndex tables.
Example
The GDEF table of Noto Sans Javanese Regular, 512 bytes, starts:
0000C324 00 01 00 00 00 0C 00 00 00 00 01 48 00 02 00 34
0000C334 00 00 00 01 00 01 00 08 00 08 00 01 00 09 00 0B
0000C344 00 03 00 0C 00 3D 00 01 00 3E 00 4D 00 03 00 4E
0000C354 00 4F 00 01 00 50 00 5B 00 03 00 5C 00 5D 00 01
| Bytes | Meaning |
|---|---|
00 01 00 00 | Version 1.0, so a 12-byte header. |
00 0C 00 00 00 00 01 48 | Glyph classes at 12; no attachment list or caret list; mark attachment classes at 328. |
00 02 00 34 | Glyph ClassDef format 2, 52 ranges. |
00 00 00 01 00 01 | Glyphs 0–1: class 1, base. |
00 08 00 08 00 01 | Glyph 8: base. Glyphs 2–7 are not listed, so class 0. |
00 09 00 0B 00 03 | Glyphs 9–11: class 3, marks. |
00 0C 00 3D 00 01 | Glyphs 12–61: bases. |
00 3E 00 4D 00 03 | Glyphs 62–77: marks. |
The GPOS kerning lookup on the GPOS
page uses mark attachment class 1 from the ClassDef at 328.