Font Tools

—fontTools Documentation—

About

fontTools is a family of libraries and utilities for manipulating fonts in Python.

The project is licensed under the MIT open-source license, allowing free usage.

Installation

Note

fontTools requires Python 3.8 or later.

To install fontTools, use pip:

pip install fonttools

Utilities

fontTools includes the following command-line utilities:

  • pyftmerge: Tool for merging fonts; see fontTools.merge

  • pyftsubset: Tool for subsetting fonts; see fontTools.subset

  • ttx: Tool for converting between OTF and XML representation; see fontTools.ttx

  • fonttools: Meta-tool for accessing other fontTools components.

For fonttools, you can use subcommands like:

  • cffLib.width: Calculate optimum defaultWidthX/nominalWidthX values

  • cu2qu: Convert a UFO font from cubic to quadratic curves

  • feaLib: Add features from a feature file (.fea) into a OTF font

  • merge: Merge multiple fonts into one

  • subset: OpenType font subsetter and optimizer

  • ttx: Convert OpenType fonts to XML and back

  • varLib: Build a variable font from a designspace file and masters

  • varLib.instancer: Partially instantiate a variable font

  • voltLib.voltToFea: Convert MS VOLT to AFDKO feature files.

Libraries

The main library for font engineering is fontTools.ttLib.ttFont, which handles TrueType/OpenType fonts. Other libraries include:

  • fontTools.afmLib: Read and write AFM files

  • fontTools.agl: Access the Adobe Glyph List

  • fontTools.cffLib: Tools for Adobe CFF fonts

  • fontTools.colorLib: Handle colors in CPAL/COLR fonts

  • fontTools.cu2qu: Convert cubic to quadratic curves

  • fontTools.designspaceLib: Read and write designspace files

  • fontTools.encodings: Support for font-related encodings

  • fontTools.feaLib: Read and write AFDKO feature files

  • fontTools.fontBuilder: Construct TTF/OTF fonts from scratch

  • fontTools.merge: Tools for merging font files

  • fontTools.subset: OpenType font subsetting and optimization

  • fontTools.svgLib.path: Draw SVG paths onto glyphs

  • fontTools.ttLib: Read/write OpenType and TrueType fonts

  • fontTools.ttx: Convert between OTF and XML representation

  • fontTools.ufoLib: Read and write UFO files

  • fontTools.unicodedata: Convert between Unicode and OpenType script info

  • fontTools.varLib: Deal with ‘gvar’-style font variations

  • fontTools.voltLib: Deal with Visual OpenType Layout Tool (VOLT) files

Optional Dependencies

fontTools has no external dependencies besides the Python Standard Library. Some optional features require additional modules; see the optional requirements page for details.

Developer Information

For developer resources, refer to the developer information.

License

fontTools is licensed under the MIT license. Refer to the full text of the license for details.