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:
- Scripts and Languages: Specifies which writing systems (e.g., Latin, Arabic) and languages use the feature.
- Features: Four-letter tags (e.g.,
liga,salt) that software exposes to users or applies automatically. - Lookups: Discrete processing units assigned to features that determine how glyphs are substituted (e.g., Single Substitution, Multiple Substitution, Ligature Substitution).
- 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
- Open your font project in FontForge.
- Go to the menu bar and select Element >
Font Info (or press
Ctrl+Shift+Fon Windows/Linux,Cmd+Shift+Fon macOS). - In the left-hand navigation list, select Lookups.
- At the top of the Lookups pane, click the GSUB tab.
Step 2: Add a New Lookup
- Click the Add Lookup button on the right side of the window.
- 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.
- Under Feature, select the appropriate OpenType tag
from the drop-down (e.g.,
liga Standard Ligatures) or enter a custom tag. - Set the Script / Language settings by clicking
New to assign target scripts (e.g.,
latnfor Latin, withdfltfor default language support). - Give the lookup a descriptive name in the Lookup Name field, then click OK.
Step 3: Add and Populate a Subtable
- Select your newly created lookup in the list.
- Click Add Subtable.
- Accept or customize the default subtable name and click OK.
- 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_imapped fromf i). - For Single Substitutions: Populate the base glyph name in the source column and the replacement glyph name in the target column.
- 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.,
- If your glyphs are properly named according to standard conventions
(such as
f_ifor an "fi" ligature), you can click Populate to have FontForge automatically generate mappings based on existing glyph names. - Click OK to close the subtable editor, then click OK in the Font Info dialog to save your changes.
Step 4: Test the Configuration
- Go to Metrics > New Metrics Window.
- Type the character sequence you configured (e.g., "fi").
- Open the Features menu in the Metrics Window to toggle the feature on and off, confirming that the substitution executes properly.
- Save your source file (
.sfd) and re-generate your font binary (.otfor.ttf) via File > Generate Fonts.