GDEF Table Examples

The rest of this chapter describes examples of all the GDEF table formats. All the examples reflect unique parameters described below, but the samples provide a useful reference for building tables specific to other situations.

The examples have three columns showing hex data, source, and comments.

Example 1: GDEF Header

Example 1 shows a GDEF Header definition with offsets to each of the main tables in GDEF.

Example 1

Hex Data

Source

Comments

GDEFHeader

TheGDEFHeader

;GDEFHeader table definition

00010000

0x00010000

;Version

000A

GlyphClassDefTable

;offset to GlyphClassDef table

0026

AttachListTable

;offset to AttachList table

0040

LigCaretListTable

;offset to LigCaretList table


Example 2: GlyphClassDef Table

The GlyphClassDef table in Example 2 specifies a glyph for the each of the glyph classes predefined in the GlyphClassDef Enumeration List.

Example 2

Hex Data

Source

Comments

ClassDefFormat2

GlyphClassDefTable

;ClassDef table definition

0002

2

;ClassFormat

0004

4

;ClassRangeCount

;ClassRangeRecord[0]

0024

iGlyphID

;Start

0024

iGlyphID

;End

0001

1

;Class

; 1 = simple glyphs

;ClassRangeRecord[1]

009F

ffiLigGlyphID

;Start

009F

ffiLigGlyphID

;End

0002

2

;Class

; 2 = ligature glyphs

;ClassRangeRecord[2]

0058

umlautAccentGlyphID

;Start

0058

umlautAccentGlyphID

;End

0003

3

;Class

; 3 = mark glyphs

;ClassRangeRecord[3]

018F

CurvedTailComponentGlyphID

;Start

018F

CurvedTailComponentGlyphID

;End

0004

4

;Class

; 4 = component glyphs


Example 3: AttachList Table

In Example 3, the AttachList table enumerates the attachment points defined for two glyphs. The GlyphCoverage table identifies the glyphs: "a" and "e." For each covered glyph, an AttachPoint table specifies the attachment point count and point indices: one point for the "a" glyph and two for the "e" glyph.

Example 3

Hex Data

Source

Comments

AttachList

AttachListTable

;AttachList table definition

0012

GlyphCoverage

;offset to Coverage table

0002

2

;GlyphCount

0008

aAttachPoint

;AttachPoint[0]

000C

eAttachPoint

;AttachPoint[1]

AttachPoint

aAttachPoint

;AttachPoint table definition

0001

1

;PointCount

0012

18

;PointIndex[0]

AttachPoint

eAttachPoint

;AttachPoint table definition

0002

2

;PointCount

000E

14

;PointIndex[0]

0017

23

;PointIndex[1]

CoverageFormat1

GlyphCoverage

;Coverage table definition

0001

1

;CoverageFormat

0002

2

;GlyphCount

001C

aGlyphID

;GlyphArray[0]

0020

eGlyphID

;GlyphArray[1]


Example 4: LigCaretList Table, LigGlyph Table and CaretValueFormat1 Table

Example 4 defines a list of ligature carets. The LigCoverage table lists all the ligature glyphs that define caret positions. In this example, two ligatures are covered, "ffi" and "fi." For each covered glyph, a LigGlyph table specifies the number of carets for the ligature and their coordinate values. The "fi" ligature defines one caret, positioned between the "f" and "i" components; the "ffi" ligature defines two, one positioned between the two "f" components and the other positioned between the "f" and "i." The CaretValue tables shown here use Format1, where values are specified in design units only.

Example 4

Hex Data

Source

Comments

LigCaretList

LigCaretListTable

;LigCaretList table definition

0008

LigCoverage

;offset to Coverage table

0002

2

;LigGlyphCount

0010

fiLigGlyph

;offset to LigGlyph table[0]

0014

ffiLigGlyph

;offset to LigGlyph table[1]

CoverageFormat1

LigCoverage

;Coverage table definition

0001

1

;CoverageFormat

0002

2

;GlyphCount

009F

ffiLigGlyphID

;GlyphArray[0]

00A5

fiLigGlyphID

;GlyphArray[1]

LigGlyph

fiLigGlyph

;LigGlyph table definition

0001

1

;CaretCount

; equals the number of

; components - 1

000E

CaretFI

;CaretValue[0]

LigGlyph

ffiLigGlyph

;LigGlyph table definition

0002

2

;CaretCount

; equals the number of

; components - 1

0006

CaretFFI1

;CaretValue[0]

000E

CaretFFI2

;CaretValue[1]

CaretValueFormat1

CaretFI

;CaretValue table definition

0001

1

;CaretValueFormat

; design units only

025B

603

;Coordinate

; X or Y value

CaretValueFormat1

CaretFFI1

;CaretValue table definition

0001

1

;CaretValueFormat

; design units only

025B

603

;Coordinate

; X or Y value

CaretValueFormat1

CaretFFI2

;CaretValue table definition

0001

1

;CaretValueFormat

; design units only

04B6

1206

;Coordinate

; X or Y value


Example 5: CaretValueFormat2 Table

Example 5 shows a CaretValueFormat2 table that specifies a ligature caret coordinate in terms of a contour point index on a specific glyph. The final position of the caret depends on the location of the contour point on the glyph after hinting.

Example 5

Hex Data

Source

Comments

CaretValueFormat2

Caret1

;CaretValue table definition

0002

2

;CaretValueFormat

; contour point

000D

13

;CaretValuePoint

; contour point index


Example 6: CaretValueFormat3 Table

In Example 6, the CaretValueFormat3 table defines a caret position in design units, but includes a Device table to adjust the X or Y coordinate for the point size and resolution of the output font. Here, the Device table specifies pixel adjustments for font sizes from 12 ppem to 17 ppem.

Example 6

Hex Data

Source

Comments

CaretValueFormat3

Caret3

;CaretValue table definition

0003

3

;CaretValueFormat

; design units plus Device table

04B6

1206

;Coordinate

; X or Y value, design units

0006

CaretDevice

;offset to Device table

DeviceTableFormat2

CaretDevice

;Device Table definition

000C

12

;StartSize

0011

17

;EndSize

0002

2

;DeltaFormat

1

; increase 12ppm by 1 pixel

1

; increase 13ppm by 1 pixel

1

; increase 14ppm by 1 pixel

1111

1

; increase 15ppm by 1 pixel

2

; increase 16ppm by 1 pixel

2200

2

; increase 17ppm by 1 pixel