Registry / serialization / babelfont

babelfont

JSON →
library3.1.3pypypi✓ verified 80d ago

A Python library to load, examine, and save fonts in multiple formats (OpenType, TrueType, UFO, etc.) with a unified object model. Version 3.1.3; released irregularly, with breaking changes in major versions.

pip install babelfont
INSTALL
IMPORT
SIG · BABELFONT
B
babelfont
serializationpythonv3.1.3
Install
3.4s avg
Import
Disk
52MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 52.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.4s · import 0.000s · 53MB
52MB installed
● package 52MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Font
from babelfont import Font
from babelfont import Babelfont

Load a TrueType font, inspect name and glyphs, then export to UFO.

from babelfont import load # Load a font file font = load("example.ttf") # Print font name and glyph count print(font.name, len(font.glyphs)) # Access a specific glyph glyph = font.glyphs["A"] print(glyph.unicode, glyph.width) # Save as UFO font.save("example.ufo")
Debug
Known issues
breakingv3.0 replaced the old Font object with Babelfont class; direct instantiation of Font is removed.
fix
Use from babelfont import Babelfont or the load function.
affects: >=3.0
breakingThe glyphs attribute is now a dict-like mapping, not a list. Indexing with integer may fail.
fix
Access glyphs by name: font.glyphs['A']. For iteration, use list(font.glyphs.values()).
affects: >=3.0
gotchaBabelfont may emit many log messages; by default it logs to stderr. This clutters output in scripts.
fix
Disable logging: import logging; logging.getLogger('babelfont').setLevel(logging.ERROR)
affects: all
gotchaWhen loading fonts, some format-specific attributes might be missing; always check with hasattr or dict access.
fix
E.g., use getattr(font, 'variations', None) or font.glyphs['A'].get('width')
affects: all
deprecatedThe low-level fontforge backend is deprecated and will be removed in v4.0.
fix
Switch to the default fonttools backend. Set backend explicitly if needed: load('file', backend='fonttools')
affects: >=3.0
Upgrade
Version history
3.1.3latest on PyPI · released Jun 11, 2025
Audit
Dependencies
fonttoolsrequiredCore dependency for font data handling
ufoLib2requiredRequired for UFO format support
ortoolsoptionalUsed for interpolation optimization (optional performance boost)
Agent activity
26 hits · last 30 days
node
20
OpenAI (training)
2
Amazon
1
Resources
babelfont — pip install babelfont · libregistry