fonttools
fonttools is a Python library for manipulating font files, currently at version 4.62.1, with a release cadence of approximately every few months.
Warnings
- breaking fonttools 4.60.0 dropped support for Python 3.9.
- deprecated The 'fonttools[ufo]' extra now uses 'fontTools.misc.filesystem' instead of 'pyfilesystem2'.
- gotcha Ensure 'setuptools' is installed to avoid build errors during installation.
Install
-
pip install fonttools
Imports
- TTFont
from fontTools.ttLib import TTFont
Quickstart
from fontTools.ttLib import TTFont
# Load a TrueType font file
font = TTFont('path_to_font.ttf')
# Access font tables
print(font.keys())
# Save changes to the font
font.save('path_to_new_font.ttf')