How to Import Feature Files into FontForge

You can import an external Adobe OpenType feature file (.fea) into an existing FontForge project. FontForge natively supports merging these feature definitions into your active font database, allowing you to manage complex OpenType layouts, kerning pairs, ligatures, and contextual alternates written outside the program. This guide details how to merge a feature file using the graphical interface, how to automate the process using FontForge's Python scripting, and how to verify that the lookups applied correctly.

Importing via the Graphical Interface

To import an external .fea file using the FontForge GUI, follow these steps:

  1. Open your existing project (.sfd) or font file in FontForge.
  2. Click on File in the main menu bar.
  3. Select Merge Feature Info... from the dropdown menu.
  4. In the file browser dialog that appears, navigate to the directory containing your .fea file.
  5. Select your feature file and click OK.

FontForge will parse the syntax in the file and convert the OpenType layout rules into internal FontForge lookups and sub-tables.

Verifying the Imported Features

After the import completes, verify that your tables, features, and lookups were successfully parsed:

  1. Navigate to Element > Font Info (or press Ctrl+Shift+F on Windows/Linux, Cmd+Shift+F on macOS).
  2. In the left-hand sidebar, select Lookups.
  3. Check both the GSUB (Glyph Substitution) and GPOS (Glyph Positioning) tabs. Your imported features—such as kern, liga, or calt—will appear here as structured lookup tables.
  4. Expand any lookup to inspect individual sub-tables and verify the glyph mapping rules.

Importing via Python Scripting

If you automate your font build process, you can merge feature files programmatically using FontForge's Python module (fontforge).

Use the mergeFeature method on the font object:

import fontforge

# Open the existing font project
font = fontforge.open("MyFont.sfd")

# Merge the external feature file
font.mergeFeature("features.fea")

# Save changes or generate the binary font
font.save("MyFont.sfd")
font.generate("MyFont.otf")

Important Considerations

  • Glyph Name Consistency: The glyph names referenced in your .fea file must match the glyph names inside your FontForge font exactly. Any mismatch will cause FontForge to ignore the rule or display an error during the parsing stage.
  • Overwriting vs. Appending: Importing a feature file merges lookups. If a lookup in the .fea file shares the same name as an existing lookup in the font, FontForge may overwrite the existing data or append rules depending on the syntax. Keep backups of your .sfd file before merging.
  • Syntax Support: FontForge supports the standard Adobe OpenType Feature File Specification, but older versions of FontForge may struggle with the newest additions to the syntax. Ensure you are running an updated release of FontForge if you use advanced OpenType 1.8+ formatting.