Add Custom Metadata to Font Headers in FontForge
FontForge allows you to modify and extend font metadata, but your ability to add completely custom metadata tags to a font header depends on whether you are working within FontForge's native format or exporting to standardized formats like OpenType (OTF) or TrueType (TTF). While TrueType and OpenType specifications enforce strict table schemas that prevent arbitrary key-value pairs in the primary header, FontForge provides specific mechanisms—such as custom name IDs and user-defined tables—to embed custom data directly into the font file.
How OpenType and TrueType Headers Handle Metadata
In OpenType and TrueType fonts, metadata is not stored as freeform
header text. Instead, it is distributed across predefined tables such as
head (Font Header), OS/2 (OS/2 and Windows
Metrics), and name (Naming Table). The actual
head table contains fixed-length, strictly defined
technical fields such as font revision, creation date, and bounding box
flags. You cannot directly inject arbitrary custom tags into the
head table itself without corrupting the font structure and
causing it to fail validation checks in operating systems and web
browsers.
Adding Custom Entries to the Name Table
The most common and compliant way to store custom metadata in
FontForge is through the name table. The name
table contains predefined Name IDs (such as 0 for Copyright, 1 for Font
Family, and 7 for Trademark), but it also permits custom user-defined
IDs.
To add a custom entry using the graphical interface:
- Open your font in FontForge.
- Navigate to Element > Font Info.
- Select TTF Names from the left-hand menu.
- Click Append or edit an unused record.
- Set the Name ID to an integer above 255 (values from 256 to 32767 are generally reserved for custom or font-specific strings).
- Enter your custom string value alongside the appropriate platform and language IDs.
Embedding Custom Tables via Python Scripting
If you need to store structured metadata (such as JSON, XML, or proprietary tracking records) that does not fit into standard strings, you can embed an entire custom table into the font. OpenType allows four-letter custom table tags (typically written in lowercase or containing specific non-standard identifiers) that parsers will ignore if they do not recognize them.
This cannot be done through the basic GUI fields alone, but it can be implemented using FontForge’s integrated Python scripting engine. Through the Python API, you can define arbitrary binary data or text and map it to a custom four-character table tag prior to generating the binary font file:
import fontforge
font = fontforge.open("MyFont.sfd")
custom_data = b"CustomMetadataKey: Value12345"
font.setTableData("cust", custom_data)
font.generate("MyFont.otf")Saving Metadata in Native SFD Files
If you only need to preserve metadata during font development and do
not require it to exist in the compiled .otf or
.ttf output, use FontForge’s native SFD (Spline Font
Database) format. SFD files are plain-text files. You can use the
Comments section in the Font Info
dialog to retain notes, version control keys, or configuration tags.
These comments persist inside the development project without violating
compiled font standards.
Compatibility and Limitations
While custom Name IDs and arbitrary tables can be successfully generated by FontForge, be aware that downstream font processing tools (such as web font compressors, subsetters, or Google OTS) may flag or strip non-standard tables and metadata during optimization. To guarantee that external systems read your metadata, place essential information within standard predefined fields like the Notice (Name ID 0), Description (Name ID 10), or Sample Text (Name ID 19) strings.