FontTools
Python library for manipulating TrueType, OpenType, and other font formats
Repository Health
Technical Analysis
FontTools is a Python library for reading, manipulating, and writing font files, supporting TrueType, OpenType, AFM, and to some extent Type 1 and Mac-specific formats. It includes the TTX tool, which converts binary TrueType/OpenType fonts into a readable XML text representation and back, making it possible to diff, script, and hand-edit font internals like glyph outlines, hinting, and OpenType layout tables.
Beyond format conversion, the library provides submodules for variable font construction (varLib), font merging and subsetting, UFO/designspace source handling, pen-based glyph drawing abstractions, and Unicode/OpenType layout utilities. It is the foundational library underneath much of the modern font-tooling ecosystem, used by font foundries, type designers, and other libraries (such as fontmake and glyphsLib) to build production font pipelines in Python.
What You Get
- A
TTFontobject model (ttLib) for parsing, editing, and writing TrueType/OpenType font binaries - The
ttxcommand-line tool to convert fonts to/from an XML text representation varLibfor building and manipulating variable fonts (OpenType Font Variations)- Subsetting (
subset) and merging (merge) modules for producing smaller or combined font files - Pen-based glyph drawing abstractions (
pens), UFO/designspace source support (ufoLib,designspaceLib), and OpenType feature compilation (feaLib)
Common Use Cases
- Building production font pipelines that generate static or variable fonts from design sources (used by tools like fontmake)
- Subsetting web fonts to reduce file size by keeping only the glyphs a page actually uses
- Inspecting or hand-editing OpenType layout tables (kerning, ligatures, variable axes) via the TTX XML round-trip
- Writing custom font QA/validation scripts that check glyph coverage, metrics, or table structure programmatically
Under The Hood
Architecture: The library is organized under Lib/fontTools/ into focused subpackages — ttLib (the core TTFont binary reader/writer and per-table classes), varLib (variable font construction/merging), subset and merge (font reduction/combination), pens (a shared glyph-outline drawing protocol used across the codebase), feaLib (OpenType feature language compiler), and ufoLib/designspaceLib (UFO source format support) — each independently importable, letting consumers pull in only the pieces they need.
Tech Stack: Pure Python 3.10+ with no required external dependencies beyond the standard library; optional extras (numpy for faster math in some modules, brotli for WOFF2, lz4, zopfli) are pulled in only when relevant features are used. Tooling includes mypy for type checking and black/tox for formatting and multi-version test matrices.
Code Quality: The extensive Tests/ directory mirrors the Lib/fontTools/ structure with per-subpackage test suites and numerous binary/XML fixtures, run across supported Python versions via tox.ini; mypy.ini enforces static typing on parts of the codebase, and the project has been continuously maintained since 1999 with active, frequent commits.
API Design: Core object access follows a consistent pattern — TTFont(path) then table access via dict-like font['glyf'] / font['GSUB'] syntax — while higher-level tasks (subsetting, variable font building, feature compilation) are exposed as dedicated modules with their own documented entry points. The TTX round-trip (font.saveXML() / TTFont(xml_path)) gives a text-diffable escape hatch into binary font internals without requiring users to understand the raw binary format.
Used by 4 apps in this directory
argilla
AI Development · Data Engineering
Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.
Authgear
Authentication
Open-source, self-hostable authentication platform with passkeys, biometric login, SSO, MFA, and GraphQL admin API — a full Auth0/Clerk/Firebase alternative for SaaS and mobile apps.
GPT Researcher
Productivity · AI Assistants
The pioneering open-source autonomous AI agent that conducts deep, multi-source research and produces citation-backed reports exceeding 2,000 words — faster and more reliably than any human researcher.
TDengine
Databases
A high-performance, open-source time-series database built in C for IoT, connected vehicles, and industrial monitoring workloads, with built-in stream processing, caching, and data subscription.