ufo2ft

raw JSON →
3.7.1 verified Mon Apr 27 auth: no python

A Python library that compiles UFO (Unified Font Object) sources into OpenType font binaries (.otf and .ttf) using FontTools. Version 3.7.1 requires Python >=3.10. It bridges UFO data structures with FontTools' font compilation pipeline, supporting features like Mark-to-Mark positioning, kern feature generation, and variable font instantiation. Release cadence is irregular with patches every few months.

pip install ufo2ft
error ModuleNotFoundError: No module named 'ufo2ft'
cause ufo2ft is not installed, or installed in a different Python environment.
fix
Run 'pip install ufo2ft' in the correct environment.
error ufo2ft.errors.UFO2FTError: missing glyphs in some masters while processing
cause Variable font compilation with inconsistent glyph sets across masters.
fix
Ensure all master UFOs contain the same set of glyphs (including empty ones if necessary).
error AttributeError: module 'ufo2ft' has no attribute 'compileInterpolatable'
cause Wrong function name; the correct function is compileInterpolatableFontFromUFOs.
fix
Use 'from ufo2ft import compileInterpolatableFontFromUFOs'.
breaking Python 3.9 dropped as of v3.7.0; requires Python >=3.10.
fix Upgrade to Python 3.10 or higher.
breaking In v3.6.8, dependencies were pinned to exact versions, causing clashes. This was fixed in v3.6.9.
fix Upgrade to v3.6.9 or later, or avoid pinning ufo2ft with exact constraints.
deprecated Some internal modules like ufo2ft.outlineCompiler may change; rely on stable public API (compileOTF, compileTTF, compileInterpolatableFontFromUFOs).
fix Use top-level imports from ufo2ft package.
gotcha ufo2ft works with both defcon and ufoLib2 for UFO objects, but v3.7.0 made neither strictly required. If using defcon, ensure it's installed separately.
fix Install defcon explicitly if needed: pip install defcon.
gotcha When compiling variable fonts, ensure all master UFOs have the same glyph set and consistent outlines; otherwise compilation may fail silently or produce incorrect data.
fix Validate master UFOs before compiling with compileInterpolatableFontFromUFOs().

Compile a single UFO into an OpenType font file.

from ufo2ft import compileOTF
from fontTools.ufoLib import UFOReader

# Replace with actual path to your .ufo
path = "path/to/font.ufo"
reader = UFOReader(path)
font = compileOTF(reader)
font.save("output.otf")
print("OpenType font saved.")