{"id":350,"library":"fonttools","title":"fonttools","description":"fonttools is a Python library for manipulating font files, currently at version 4.62.1, with a release cadence of approximately every few months.","status":"active","version":"4.62.1","language":"python","source_language":"en","source_url":"https://github.com/fonttools/fonttools","tags":["font","manipulation","TrueType","OpenType","Python"],"install":[{"cmd":"pip install fonttools","lang":"bash","label":"Install fonttools"}],"dependencies":[{"reason":"Required for building and installing fonttools","package":"setuptools","optional":false}],"imports":[{"note":"Ensure correct import path to avoid ImportError.","symbol":"TTFont","correct":"from fontTools.ttLib import TTFont"}],"quickstart":{"code":"from fontTools.ttLib import TTFont\n\n# Load a TrueType font file\nfont = TTFont('path_to_font.ttf')\n\n# Access font tables\nprint(font.keys())\n\n# Save changes to the font\nfont.save('path_to_new_font.ttf')","lang":"python","description":"This script demonstrates loading a TrueType font, accessing its tables, and saving changes."},"warnings":[{"fix":"Upgrade to Python 3.10 or later.","message":"fonttools 4.60.0 dropped support for Python 3.9.","severity":"breaking","affected_versions":">=4.60.0"},{"fix":"Update your imports to 'from fontTools.misc.filesystem import ...'.","message":"The 'fonttools[ufo]' extra now uses 'fontTools.misc.filesystem' instead of 'pyfilesystem2'.","severity":"deprecated","affected_versions":">=4.59.0"},{"fix":"Install 'setuptools' using 'pip install setuptools'.","message":"Ensure 'setuptools' is installed to avoid build errors during installation.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Verify that the path provided to 'TTFont' (e.g., 'path_to_font.ttf') correctly points to an existing font file on your system.","message":"The 'TTFont' constructor received a path to a font file that does not exist. Ensure the specified font file path is correct and the file is accessible.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure the font file specified in the TTFont() constructor (e.g., 'path_to_font.ttf') exists at the given path and that the application has the necessary read permissions.","message":"The TTFont() constructor failed because the specified font file could not be found.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'4.62.1':14 'approxim':20 'cadenc':18 'current':11 'everi':21 'file':10 'font':9,24 'fonttool':1,2 'librari':6 'manipul':8,25 'month':23 'opentyp':27 'python':5,28 'releas':17 'truetyp':26 'version':13","created_at":"2026-03-28T10:51:41.522470+00:00","updated_at":"2026-04-16T15:10:30.441322+00:00","problems":[{"fix":"pip install fonttools","cause":"The 'fonttools' library is not installed in the Python environment being used, or the Python environment is not correctly configured to find it.","error":"ImportError: No module named fontTools"},{"fix":"from fontTools.varLib.instancer import AxisTriple; instantiateSTAT(font, {\"wght\":AxisTriple(500,500,900)})","cause":"When calling 'fontTools.varLib.instancer.instantiateSTAT' or related variable font functions, axis limits are provided as plain tuples (e.g., '(500, 900)'), but the functions expect 'AxisTriple' objects.","error":"AttributeError: 'tuple' object has no attribute 'minimum'"},{"fix":"pip install brotli","cause":"The 'brotli' compression library, a required dependency for processing WOFF2 font files, is not installed in the Python environment.","error":"ImportError: No module named brotli"},{"fix":"import os; os.system(\"ttx /path/to/font.ttf\") OR import subprocess; subprocess.run([\"ttx\", \"/path/to/font.ttf\"])","cause":"The 'ttx' command is a command-line utility provided by 'fonttools' and cannot be executed directly as a Python statement within a script; it must be run via the operating system's shell.","error":"SyntaxError: invalid syntax (when trying to run 'ttx' command directly in Python script)"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":0,"quickstart_tag":"stale","pypi_latest":"4.63.0","cli_name":"pyftsubset","cli_version":"usage: fonttools subset font-file [glyph...] [--option=value]...","type":"library","homepage":null,"github":"http://github.com/fonttools/fonttools","docs":null,"changelog":null,"pypi":"https://pypi.org/project/fonttools/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":"verified"}}