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:
- Open your existing project (
.sfd) or font file in FontForge. - Click on File in the main menu bar.
- Select Merge Feature Info... from the dropdown menu.
- In the file browser dialog that appears, navigate to the directory
containing your
.feafile. - 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:
- Navigate to Element > Font Info
(or press
Ctrl+Shift+Fon Windows/Linux,Cmd+Shift+Fon macOS). - In the left-hand sidebar, select Lookups.
- Check both the GSUB (Glyph Substitution) and
GPOS (Glyph Positioning) tabs. Your imported
features—such as
kern,liga, orcalt—will appear here as structured lookup tables. - 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
.feafile 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
.feafile 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.sfdfile 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.