Write Raw Feature File Syntax in FontForge

FontForge supports Adobe OpenType Feature File syntax (.fea), but it does not provide an integrated live text editor inside the GUI to write and maintain raw feature code continuously. Instead, FontForge requires you to write your syntax externally and import it, or apply it programmatically via scripting. Once imported, FontForge translates the syntax into its internal visual lookup system rather than preserving the raw text file.

How FontForge Handles Feature Files

FontForge converts Adobe feature file syntax directly into its internal OpenType lookup structures. Because FontForge manages GPOS (glyph positioning) and GSUB (glyph substitution) through an interactive database rather than a text document, any raw syntax imported into the program is parsed immediately. This means custom formatting, macros, and comments inside your .fea file will not be preserved inside the native .sfd font database.

Merging Feature Files via the GUI

To apply raw feature syntax to your font using the graphical interface:

  1. Create and edit your feature file using a standard external text editor or code editor (such as VS Code, Sublime Text, or Notepad++). Save the file with a .fea extension.
  2. Open your font project in FontForge.
  3. Navigate to File > Merge Feature Info... in the main font view menu.
  4. Select your .fea file and confirm.

FontForge will parse the file and populate the corresponding tables. You can inspect the imported rules by opening Element > Font Info and clicking on the Lookups tab.

Applying Feature Files with Python

If you prefer an automated workflow, FontForge's Python scripting module allows you to apply raw feature files directly without manual menu navigation:

import fontforge

font = fontforge.open("MyFont.sfd")
font.mergeFeature("features.fea")
font.generate("MyFont.otf")

The mergeFeature() method reads your syntax, checks for errors, and integrates the OpenType layout rules directly into the font before generation.

Exporting Feature Syntax from FontForge

If you previously set up lookups using FontForge’s visual lookup editor, you can export them into raw Adobe feature file syntax:

  1. Open your project in FontForge.
  2. Go to File > Save Feature Info....
  3. Choose a destination and save the file with a .fea extension.

This generates a structured feature file based on FontForge’s internal tables, which you can then edit externally and re-import as needed.