Anchor-Based Accent Positioning in FontForge
Anchor-based attachment in FontForge is a typographical mechanism used to position diacritical marks precisely above, below, or through base glyphs using coordinate points rather than static, manual positioning. By assigning corresponding "base" and "mark" anchor points to individual glyphs, font designers can ensure that accents automatically align across various letterforms and contexts through OpenType GPOS (Glyph Positioning) tables. This method eliminates the need for hardcoding complex manual shifts, drastically reduces design errors, and enables seamless dynamic text rendering for international writing systems.
Understanding Anchor Points
Anchor points are invisible x- and y-coordinate markers placed inside a glyph's design canvas. They work in matching pairs:
- Base Anchors: Placed on base characters (such as
vowels or consonants) to mark where an accent should sit. A typical base
glyph might have a
topanchor for accents like acutes and umlauts, and abottomanchor for cedillas and ogoneks. - Mark Anchors: Placed on diacritics (the accents
themselves). A mark anchor uses an underscore prefix (e.g.,
_top) to signify that it is designed to snap to a corresponding base anchor.
When a layout engine processes a base character followed by a
combining mark, it shifts the mark glyph so that the _top
anchor aligns precisely with the top anchor of the base
glyph.
OpenType Tables:
mark and mkmk
Anchor-based positioning generates OpenType GPOS data, primarily using two layout features:
- Mark-to-Base (
mark): Connects a diacritic to a standard glyph (e.g., snapping an acute accent to the letter "e"). - Mark-to-Mark (
mkmk): Connects a secondary accent to a primary accent (e.g., stacking a tilde over an acute accent in Vietnamese typography). In this case, the first accent has both an incoming attachment anchor (_top) and an outgoing attachment anchor (top) for the stacked mark.
Setting Up Anchors in FontForge
Implementing anchor-based attachment in FontForge follows a standardized workflow:
- Create the Lookup Class: Open Element >
Font Info > Lookups > GPOS. Add a new lookup, set the
feature to
mark(Mark-to-Base Attachment), and define an Anchor Class (such asTopAccent). - Assign Base Points: Open a base glyph window (e.g.,
a). Select Point > Add Anchor. Select theTopAccentclass, set the type to Base, and move the anchor to the desired coordinate above the glyph. - Assign Mark Points: Open the corresponding
diacritic (e.g.,
acutecomb). Select Point > Add Anchor, chooseTopAccent, set the type to Mark, and position it at the attachment point (often near the lower baseline of the floating mark). - Preview the Alignment: Use the Metrics window (Metrics > New Metrics Window) and type the sequence (e.g., base glyph + combining mark) to test real-time snapping.
Advantages Over Precomposed Glyphs
While traditional fonts rely heavily on hardcoded precomposed glyphs
(like U+00E9 for "é"), anchor-based attachment offers
superior flexibility:
- Italic Correction: Slanted letterforms place accents at different visual centers. Anchors allow exact custom placement per glyph without shifting the bounding box.
- Stacking Accents: Complex scripts such as Arabic, Hebrew, and Vietnamese require stacking multiple marks. Anchors handle multi-tier stacking predictably.
- Arbitrary Combinations: Non-standard academic, phonetic (IPA), or minority-language diacritic combinations render accurately even if a precomposed character does not exist in Unicode.