How to Configure GSUB Lookups in FontForge

This guide explains what a GSUB (Glyph Substitution) lookup table is and provides step-by-step instructions for configuring one using FontForge. You will learn the role GSUB plays in OpenType typography, the basic hierarchy of OpenType features, and the exact steps required to create and map substitution rules such as ligatures or alternate glyphs in your font projects.


What Is a GSUB Lookup Table?

The GSUB (Glyph Substitution) table is a core component of the OpenType font format. It instructs text rendering engines to replace default glyphs with alternate glyphs under specific conditions. Common use cases include:

  • Ligatures (liga, dlig): Replacing sequences like "f" followed by "i" with a single "fi" glyph.
  • Small Capitals (smcp): Replacing lowercase characters with small-cap variants.
  • Contextual Alternates (calt): Swapping glyph forms depending on preceding or following letters.
  • Fractions (frac): Converting numeric sequences separated by slashes into true typographic fractions.

Within the GSUB table, typographic behavior is organized hierarchically:

  1. Scripts and Languages: Specifies which writing systems (e.g., Latin, Arabic) and languages use the feature.
  2. Features: Four-letter tags (e.g., liga, salt) that software exposes to users or applies automatically.
  3. Lookups: Discrete processing units assigned to features that determine how glyphs are substituted (e.g., Single Substitution, Multiple Substitution, Ligature Substitution).
  4. Subtables: The actual mapping data containing the source glyphs and their target replacements.

How to Configure a GSUB Lookup in FontForge

Follow these steps to create and configure a GSUB lookup in FontForge:

Step 1: Open the Lookups Window

  1. Open your font project in FontForge.
  2. Go to the menu bar and select Element > Font Info (or press Ctrl+Shift+F on Windows/Linux, Cmd+Shift+F on macOS).
  3. In the left-hand navigation list, select Lookups.
  4. At the top of the Lookups pane, click the GSUB tab.

Step 2: Add a New Lookup

  1. Click the Add Lookup button on the right side of the window.
  2. In the Type drop-down menu, choose the substitution type that matches your requirement:
    • Single Substitution: Replaces one glyph with another (e.g., default character to small cap).
    • Multiple Substitution: Replaces one glyph with multiple glyphs.
    • Alternate Substitution: Provides a choice of multiple alternates for a single glyph.
    • Ligature Substitution: Combines multiple glyphs into a single glyph.
  3. Under Feature, select the appropriate OpenType tag from the drop-down (e.g., liga Standard Ligatures) or enter a custom tag.
  4. Set the Script / Language settings by clicking New to assign target scripts (e.g., latn for Latin, with dflt for default language support).
  5. Give the lookup a descriptive name in the Lookup Name field, then click OK.

Step 3: Add and Populate a Subtable

  1. Select your newly created lookup in the list.
  2. Click Add Subtable.
  3. Accept or customize the default subtable name and click OK.
  4. A mapping dialog will appear depending on the lookup type selected:
    • For Ligatures: Enter the name of the resulting ligature glyph in the first column, followed by the component glyph names separated by spaces in the second column (e.g., f_i mapped from f i).
    • For Single Substitutions: Populate the base glyph name in the source column and the replacement glyph name in the target column.
  5. If your glyphs are properly named according to standard conventions (such as f_i for an "fi" ligature), you can click Populate to have FontForge automatically generate mappings based on existing glyph names.
  6. Click OK to close the subtable editor, then click OK in the Font Info dialog to save your changes.

Step 4: Test the Configuration

  1. Go to Metrics > New Metrics Window.
  2. Type the character sequence you configured (e.g., "fi").
  3. Open the Features menu in the Metrics Window to toggle the feature on and off, confirming that the substitution executes properly.
  4. Save your source file (.sfd) and re-generate your font binary (.otf or .ttf) via File > Generate Fonts.