How to Compile and Test OpenType Features in FontForge

OpenType features allow fonts to perform advanced typographic behaviors such as ligatures, kerning, contextual alternates, and small caps. This guide explains how to define, compile, and test OpenType substitutions and positioning tables directly within FontForge, as well as how to verify their behavior in the Metrics window before generating your final font files.

1. Setting Up and Compiling Features in FontForge

FontForge handles OpenType features through Lookups inside the font metadata. Features are broadly categorized into Glyph Substitution (GSUB) and Glyph Positioning (GPOS).

  1. Open your font project in FontForge.
  2. Navigate to Element > Font Info (or press Ctrl+Shift+F / Cmd+Shift+F).
  3. Select Lookups from the sidebar menu.
  4. Choose either the GSUB tab (for ligatures, alternates, and substitutions) or the GPOS tab (for kerning and mark attachment).

Adding Lookups and Subtables

  1. Click Add Lookup.
  2. Set the Type (e.g., Ligature Substitution for liga, or Pair Position (kerning) for kern).
  3. In the feature list, assign the appropriate four-letter OpenType tag (such as liga, dlig, kern, or calt) and select the target script and language system.
  4. Click OK, select the newly created lookup, and click Add Subtable.
  5. Define your glyph mapping rules in the subtable editor. For ligatures, specify the resulting glyph and the sequence of component glyphs. For kerning, adjust pair offsets manually or assign kerning classes.

Importing External Adobe Feature Files (.fea)

If you prefer writing feature code manually using Adobe Fea syntax:

  1. Go to File > Merge Feature Info....
  2. Select your .fea file.
  3. FontForge will compile the syntax into internal GSUB/GPOS lookups. Check the output log for compilation syntax errors.

2. Testing OpenType Features in the Metrics Window

FontForge includes an integrated layout engine that allows you to test OpenType tables dynamically without needing to export the font.

  1. Go to Metrics > New Metrics Window (or press Ctrl+K / Cmd+K).
  2. In the text field at the top, type the character sequence designed to trigger your feature (for example, fi for a standard ligature or AV for kerning).
  3. Open the Features panel inside the Metrics window:
    • Go to View > Features within the Metrics window menu.
    • A dockable list of available OpenType tags (e.g., liga, kern, calt) will appear.
  4. Toggle the checkboxes corresponding to your features.
    • When checked, FontForge applies the lookup rules in real time, transforming the text display.
    • When unchecked, the glyphs revert to their default, unshaped representations.
  5. Inspect the optical alignment, vertical positioning, and substitution accuracy directly on the canvas.

3. Validating and Exporting

After confirming the behavior inside the Metrics window:

  1. Run the validator by selecting Element > Validation > Find Problems to ensure there are no missing glyph references, unencoded glyphs, or broken anchors.
  2. Navigate to File > Generate Fonts....
  3. Choose either OpenType (CFF) (.otf) or TrueType (.ttf).
  4. Click the Options button and verify that OpenType tables are checked so the compiled lookups are written into the binary font.
  5. Generate the file and test it in production environments, such as web browsers or desktop publishing software, to ensure system-level HarfBuzz or DirectWrite engines render the features as expected.