Export Font Tables to XML or Text in FontForge
This guide explains how to extract font tables as raw text or XML using FontForge. While FontForge is primarily an outline editor, you can export font table data into human-readable formats by saving the font as a native Spline Font Database (SFD) text file, exporting OpenType tables as feature text files, or using FontForge's built-in Python scripting environment to dump raw table bytes directly to disk.
Method 1: Export Complete Font Data as Text (.sfd)
FontForge’s native file format is the Spline Font Database
(.sfd), which stores every font table, glyph outline,
metadata field, and metric in plain, human-readable ASCII text.
- Open your font in FontForge via File > Open.
- Navigate to File > Save As....
- In the file format dropdown, select **Spline Font Database (*.sfd)**.
- Choose a destination and click Save.
- Open the resulting
.sfdfile in any text editor to view or parse raw table definitions, such as thehead,hhea,OS/2, and lookup tables.
Method 2: Export OpenType Layout Tables as Feature Text (.fea)
If you need layout tables such as GSUB (substitutions)
or GPOS (positioning) in an editable text format, you can
export them using Adobe Feature File syntax.
- Go to Element > Font Info (or press
Ctrl+Shift+F/Cmd+Shift+F). - Select Lookups from the left-hand sidebar.
- Click the Save Feature File... button at the bottom of the window.
- Choose a file name ending in
.feaand click Save.
The generated file contains the raw OpenType layout table rules represented as standardized plain text.
Method 3: Export Raw Table Data via FontForge Python
FontForge includes an integrated Python engine capable of reading any
binary TrueType or OpenType table using the getTableData()
method. You can dump tables as raw binary, hex text, or XML.
- Open your font in FontForge.
- Navigate to File > Execute Script....
- Select Python as the scripting language.
- Enter the following script to dump a specific table (e.g., the
nametable orOS/2table) as hex-encoded text:
import fontforge
# Reference the active font
font = fontforge.activeFont()
# Specify the 4-character table tag you want to extract
table_tag = "OS/2"
try:
# Retrieve the raw binary data
raw_data = font.getTableData(table_tag)
# Save as plain hex text
with open(f"{font.fontname}_{table_tag}.txt", "w") as f:
f.write(raw_data.hex())
print(f"Table '{table_tag}' successfully exported to text.")
except Exception as e:
print(f"Error extracting table: {e}")- Click OK to run the script. The output file will be written to your working directory.
Method 4: Export Tables as Raw XML Using FontTools (TTX)
FontForge does not contain an internal native XML serializer for all
binary tables. To convert raw font tables directly into formatted XML,
run the FontTools ttx utility alongside FontForge:
Open your terminal or command prompt.
Use FontTools to dump all tables to an XML file:
ttx -o font_tables.xml input_font.ttfTo extract only a specific table as raw XML, pass the
-tflag:ttx -t name -t "OS/2" -o specific_tables.xml input_font.ttf