How to Use GPOS Lookup Tables in FontForge
This article provides a concise overview of OpenType Glyph Positioning (GPOS) lookup tables and explains how to create, configure, and apply them using FontForge. You will learn the fundamental purpose of GPOS within font engineering, the distinction between lookups and subtables, and step-by-step instructions for implementing pair positioning (kerning) and mark-to-base positioning in your font projects.
What Is a GPOS Lookup Table?
The GPOS (Glyph Positioning) table is an OpenType layout table that defines precise spacing, shifting, and alignment between glyphs without altering their identities. Unlike the GSUB (Glyph Substitution) table, which replaces glyphs (such as creating ligatures), GPOS adjusts horizontal and vertical coordinates dynamically.
A GPOS table is organized into a hierarchy:
- Features: User-facing behaviors or language
requirements defined by four-character tags (e.g.,
kernfor kerning,markfor diacritic placement). - Lookups: Individual processing units linked to a feature that define how positioning should be calculated.
- Subtables: Specific datasets within a lookup containing glyph pairs, anchor points, or positioning offsets.
Common GPOS lookup types include:
- Single Adjustment: Modifies the advance width or placement of an individual glyph.
- Pair Adjustment: Adjusts the distance between two specific glyphs (the foundation of kerning).
- Mark-to-Base: Aligns combining marks (such as accents) onto base glyphs using coordinated anchor points.
- Cursive Attachment: Connects adjacent glyphs seamlessly in connected scripts like Arabic.
Step-by-Step: Creating a GPOS Kerning Lookup in FontForge
Pair kerning is the most common use of GPOS in FontForge. Follow these steps to implement a horizontal kerning lookup:
1. Open the Lookups Window
- Open your font project in FontForge.
- Go to Element > Font Info from the top menu.
- In the sidebar, select Lookups, then click the GPOS tab at the top.
2. Add a New Lookup
- Click the Add Lookup button on the right side.
- In the Type dropdown, select Pair Position (kerning).
- Under Feature, select or type
kern(Horizontal Kerning). - Set the script and language systems (typically
latnwith default language, or select specific scripts as needed). - Leave the lookup name as generated, or assign a descriptive name. Click OK.
3. Add a Subtable
- Select the newly created lookup row.
- Click Add Subtable.
- Choose whether to kern by individual pairs (manual
pairs) or by classes (grouping visually similar glyphs
like
O,C,G,Qto save file size). - Name the subtable and click OK.
4. Define Kerning Values
- If using Classes: Define your left-hand and right-hand glyph classes, then input kerning values in the matrix view.
- If using Individual Pairs: Use
Metrics > New Metrics Window from
the main FontForge interface. Type your target character pairs (e.g.,
AV,To), drag the spacing manually between them, or enter a numeric kerning offset in the kerning field. FontForge automatically updates your GPOS subtable.
Implementing Mark-to-Base Positioning
To anchor accents dynamically over letters:
- Navigate to Element > Font Info > Lookups > GPOS.
- Click Add Lookup and choose Mark to Base Position as the Type.
- Assign the
markfeature tag, select your target script, and click OK. - Select the lookup and click Add Subtable.
- Define anchor classes (e.g.,
topfor accents placed above letters). - Open your base glyphs (such as
e) and mark glyphs (such asacutecomb), then go to Point > Add Anchor to assign coordinates where the mark and base should attach.
Validating and Generating
Once your GPOS lookups are configured:
- Preview your rules directly in FontForge using Metrics > New Metrics Window.
- Toggle OpenType features on and off within the Metrics window via the Features menu to ensure your GPOS tables behave correctly.
- Generate your font via File > Generate
Fonts, ensuring you export as an OpenType format
(
OTForTTF) to retain the compiled GPOS binary data.