How to Add Superscript and Subscript in FontForge

Implementing superscript and subscript OpenType features in FontForge allows applications to dynamically replace standard numbers and letters with elevated or lowered variants. This tutorial covers the end-to-end process of setting up these substitutions, including glyph naming conventions, creating OpenType Substitution (GSUB) lookups, mapping standard characters to their modified counterparts, and validating the final font.

1. Create and Name the Variant Glyphs

Before configuring substitutions, you must have the actual superscript and subscript glyphs drawn in your font file.

  1. Create your scaled-down and vertically shifted glyphs.
  2. Name each variant using standard OpenType suffix conventions:
    • For superscripts, append .sups to the base glyph name (e.g., one.sups, two.sups, a.sups). Alternatively, use standard Adobe names like onesuperior.
    • For subscripts, append .subs to the base glyph name (e.g., one.subs, two.subs, a.subs). Alternatively, use standard Adobe names like oneinferior.

2. Configure the Superscript (sups) Lookup

Substitutions are handled through the OpenType Layout tables under the Font Info dialog.

  1. Go to Element > Font Info (or press Ctrl+Shift+F / Cmd+Shift+F).
  2. Select Lookups from the left sidebar menu.
  3. Ensure you are on the GSUB tab at the top.
  4. Click Add Lookup.
  5. Set the Type dropdown to Single Substitution.
  6. Under the Feature column, select or type sups (Superscript/Superior).
  7. Click OK.
  8. Select the newly created lookup and click Add Subtable. Accept the default subtable name and click OK.
  9. In the subtable dialog, populate the mapping:
    • Click Populate to automatically match glyphs based on naming conventions (e.g., one to one.sups), or:
    • Manually add rows by typing the base glyph name under Base Glyph Name and the replacement under Replacement Glyph Name.
  10. Click OK to save the subtable.

3. Configure the Subscript (subs) Lookup

Follow the same procedure to set up subscript substitution:

  1. In the GSUB lookups panel, click Add Lookup.
  2. Set the Type to Single Substitution.
  3. Under Feature, select or type subs (Subscript/Inferior).
  4. Click OK.
  5. Select the subscript lookup, click Add Subtable, and accept the name.
  6. Click Populate to automatically pair .subs variants with their base counterparts, or map them manually.
  7. Click OK, then click OK in the main Font Info window to apply changes.

4. Test and Export the Font

  1. Open a new metrics window via Metrics > New Metrics Window.
  2. Type a sequence of characters (e.g., H2O or x2).
  3. In the metrics window menu, navigate to Features and toggle subs or sups on to confirm the characters swap correctly.
  4. Export your font by choosing File > Generate Fonts, selecting OpenType (CFF) or TrueType, and ensuring OpenType tables are included in the build options.