freshcrate
Home > RAG & Memory > fonttools

fonttools

Tools to manipulate font files

Description

|CI Build Status| |Coverage Status| |PyPI| |Gitter Chat| What is this? ~~~~~~~~~~~~~ | fontTools is a library for manipulating fonts, written in Python. The project includes the TTX tool, that can convert TrueType and OpenType fonts to and from an XML text format, which is also called TTX. It supports TrueType, OpenType, AFM and to an extent Type 1 and some Mac-specific formats. The project has an `MIT open-source license <LICENSE>`__. | Among other things this means you can use it free of charge. `User documentation <https://fonttools.readthedocs.io/en/latest/>`_ and `developer documentation <https://fonttools.readthedocs.io/en/latest/developer.html>`_ are available at `Read the Docs <https://fonttools.readthedocs.io/>`_. Installation ~~~~~~~~~~~~ FontTools requires `Python <http://www.python.org/download/>`__ 3.10 or later. We try to follow the same schedule of minimum Python version support as NumPy (see `NEP 29 <https://numpy.org/neps/nep-0029-deprecation_policy.html>`__). The package is listed in the Python Package Index (PyPI), so you can install it with `pip <https://pip.pypa.io>`__: .. code:: sh pip install fonttools If you would like to contribute to its development, you can clone the repository from GitHub, install the package in 'editable' mode and modify the source code in place. We recommend creating a virtual environment, using `virtualenv <https://virtualenv.pypa.io>`__ or Python 3 `venv <https://docs.python.org/3/library/venv.html>`__ module. .. code:: sh # download the source code to 'fonttools' folder git clone https://github.com/fonttools/fonttools.git cd fonttools # create new virtual environment called e.g. 'fonttools-venv', or anything you like python -m virtualenv fonttools-venv # source the `activate` shell script to enter the environment (Unix-like); to exit, just type `deactivate` . fonttools-venv/bin/activate # to activate the virtual environment in Windows `cmd.exe`, do fonttools-venv\Scripts\activate.bat # install in 'editable' mode pip install -e . Optional Requirements --------------------- The ``fontTools`` package currently has no (required) external dependencies besides the modules included in the Python Standard Library. However, a few extra dependencies are required by some of its modules, which are needed to unlock optional features. The ``fonttools`` PyPI distribution also supports so-called "extras", i.e. a set of keywords that describe a group of additional dependencies, which can be used when installing via pip, or when specifying a requirement. For example: .. code:: sh pip install fonttools[ufo,lxml,woff,unicode] This command will install fonttools, as well as the optional dependencies that are required to unlock the extra features named "ufo", etc. - ``Lib/fontTools/misc/etree.py`` The module exports a ElementTree-like API for reading/writing XML files, and allows to use as the backend either the built-in ``xml.etree`` module or `lxml <https://lxml.de>`__. The latter is preferred whenever present, as it is generally faster and more secure. *Extra:* ``lxml`` - ``Lib/fontTools/ttLib/woff2.py`` Module to compress/decompress WOFF 2.0 web fonts; it requires: * `brotli <https://pypi.python.org/pypi/Brotli>`__: Python bindings of the Brotli compression library. *Extra:* ``woff`` - ``Lib/fontTools/ttLib/sfnt.py`` To better compress WOFF 1.0 web fonts, the following module can be used instead of the built-in ``zlib`` library: * `zopfli <https://pypi.python.org/pypi/zopfli>`__: Python bindings of the Zopfli compression library. *Extra:* ``woff`` - ``Lib/fontTools/unicode.py`` To display the Unicode character names when dumping the ``cmap`` table with ``ttx`` we use the ``unicodedata`` module in the Standard Library. The version included in there varies between different Python versions. To use the latest available data, you can install: * `unicodedata2 <https://pypi.python.org/pypi/unicodedata2>`__: ``unicodedata`` backport for Python 3.x updated to the latest Unicode version 17.0. *Extra:* ``unicode`` - ``Lib/fontTools/varLib/interpolatable.py`` Module for finding wrong contour/component order between different masters. It requires one of the following packages in order to solve the so-called "minimum weight perfect matching problem in bipartite graphs", or the Assignment problem: * `scipy <https://pypi.python.org/pypi/scipy>`__: the Scientific Library for Python, which internally uses `NumPy <https://pypi.python.org/pypi/numpy>`__ arrays and hence is very fast; * `munkres <https://pypi.python.org/pypi/munkres>`__: a pure-Python module that implements the Hungarian or Kuhn-Munkres algorithm. Slower than SciPy, but useful for minimalistic systems where adding SciPy is undesirable. This ensures both performance (via SciPy) and minimal footprint (via Munkres) are possible. To plot the result

Release History

VersionChangesUrgencyDate
4.62.1Imported from PyPI (4.62.1)Low4/21/2026
4.62.0- [diff] Add new `fonttools diff` command for comparing font files, imported from the `fdiff` project and heavily reworked (#1190, #4007, #4009, #4011, #4013, #4019). - [feaLib] Fix `VariableScalar` interpolation bug with non-linear avar mappings. Also decouple `VariableScalar` from compiled fonts, allowing it to work with designspace data before compilation (#3938, #4054). - [feaLib] Fix `VariableScalar` axis ordering and iterative delta rounding to match fontc behavior (#4053). - [feaLib] MergLow3/9/2026
4.61.1- [otlLib] buildCoverage: return empty Coverage instead of None (#4003, #4004). - [instancer] bug fix in ``avar2`` full instancing (#4002). - [designspaceLib] Preserve empty conditionsets when serializing to XML (#4001). - [fontBu ilder] Fix FontBuilder ``setupOS2()`` default params globally polluted (#3996, #3997). - [ttFont] Add more typing annotations to ttFont, xmlWriter, sfnt, varLib.models and others (#3952, #3826). - Explicitly test and declare support for Python 3.14, even though weLow12/12/2025
4.60.2- **Backport release** Same as 4.61.0 but without "Drop support for EOL Python 3.9" change to allow downstream projects still on Python 3.9 to avail of the security fix for CVE-2025-66034 (#3994, #3999).Low12/9/2025
4.61.0- [varLib.main]: **SECURITY** Only use basename(vf.filename) to prevent path traversal attacks when running `fonttools varLib` command-line script, or code which invokes `fonttools.varLib.main()`. Fixes CVE-2025-66034, see: https://github.com/fonttools/fonttools/security/advisories/GHSA-768j-98cg-p3fv. - [feaLib] Sort BaseLangSysRecords by tag (#3986). - Drop support for EOL Python 3.9 (#3982). - [instancer] Support --remove-overlaps for fonts with CFF2 table (#3975). - [CFF2ToCFF] Add --remLow11/28/2025
4.60.1- [ufoLib] Reverted accidental method name change in ``UFOReader.getKerningGroupConversionRenameMaps`` that broke compatibility with downstream projects like defcon (#3948, #3947, robotools/defcon#478). - [ufoLib] Added test coverage for ``getKerningGroupConversionRenameMaps`` method (#3950). - [subset] Don't try to subset BASE table; pass it through by default instead (#3949). - [subset] Remove empty BaseRecord entries in MarkBasePos lookups (#3897, #3892). - [subset] Add pruning for MarLow9/29/2025
4.60.0- [pointPen] Allow ``reverseFlipped`` parameter of ``DecomposingPointPen`` to take a ``ReverseFlipped`` enum value to control whether/how to reverse contour direction of flipped components, in addition to the existing True/False. This allows to set ``ReverseFlipped.ON_CURVE_FIRST`` to ensure that the decomposed outline starts with an on-curve point before being reversed, for better consistency with other segment-oriented contour transformations. The change is backward compatible, and the defaultLow9/17/2025
4.59.2- [varLib] Clear ``USE_MY_METRICS`` component flags when inconsistent across masters (#3912). - [varLib.instancer] Avoid negative advance width/height values when instatiating HVAR/VVAR, (unlikely in well-behaved fonts) (#3918). - [subset] Fix shaping behaviour when pruning empty mark sets (#3915, harfbuzz/harfbuzz#5499). - [cu2qu] Fixed ``dot()`` product of perpendicular vectors not always returning exactly 0.0 in all Python implementations (#3911) - [varLib.instancer] Implemented fully-insLow8/27/2025
4.59.1- [featureVars] Update OS/2.usMaxContext if possible after addFeatureVariationsRaw (#3894). - [vhmtx] raise TTLibError('not enough data...') when hmtx/vmtx are truncated (#3843, #3901). - [feaLib] Combine duplicate features that have the same set of lookups regardless of the order in which those lookups are added to the feature (#3895). - [varLib] Deprecate ``varLib.mutator`` in favor of ``varLib.instancer``. The latter provides equivalent full (static font) instancing in addition to partial Low8/14/2025
4.59.0- Removed hard-dependency on pyfilesystem2 (``fs`` package) from ``fonttools[ufo]`` extra. This is replaced by the ``fontTools.misc.filesystem`` package, a stdlib-only, drop-in replacement for the subset of the pyfilesystem2's API used by ``fontTools.ufoLib``. The latter should continue to work with the upstream ``fs`` (we even test with/without). However, clients who wish to continue using ``fs`` can do so by depending on it directly instead of via the ``fonttools[ufo]`` extra (#3885, #3620). Low7/16/2025
4.58.5- [feaLib] Don't try to combine ligature & multisub rules (#3874). - [feaLib/ast] Use weakref proxies to avoid cycles in visitor (#3873). - [varLib.instancer] Fixed instancing CFF2 fonts where VarData contains more than 64k items (#3858).Low7/3/2025
4.58.4- [feaLib] Fixed iterable check for Python 3.13.4 and newer (#3854, #3855).Low6/13/2025
4.58.3- [feaLib] Fixed iterable check for Python 3.13.4 and newer (#3854, #3855). Low6/13/2025
4.58.2- [ttLib.reorderGlyphs] Handle CFF2 when reordering glyphs (https://github.com/fonttools/fonttools/pull/3852) - [subset] Copy name IDs in use before scrapping or scrambling them for webfonts (https://github.com/fonttools/fonttools/pull/3853)Low6/6/2025
4.58.1- [varLib] Make sure that fvar named instances only reuse name ID 2 or 17 if they are at the default location across all axes, to match OT spec requirement (#3831). - [feaLib] Improve single substitution promotion to multiple/ligature substitutions, fixing a few bugs as well (#3849). - [loggingTools] Make ``Timer._time`` a static method that doesn't take self, makes it easier to override (#3836). - [featureVars] Use ``None`` for empty ConditionSet, which translates to a null offset in the comLow5/28/2025
4.58.0- Drop Python 3.8, require 3.9+ (#3819) - [HVAR, VVAR] Prune unused regions when using a direct mapping (#3797) - [Docs] Improvements to ufoLib documentation (#3721) - [Docs] Improvements to varLib documentation (#3727) - [Docs] Improvements to Pens and pen-module documentation (#3724) - [Docs] Miscellany updates to docs (misc modules and smaller modules) (#3730) - [subset] Close codepoints over BiDi mirror variants. (#3801) - [feaLib] Fix serializing ChainContextPosStatement and ChainConLow5/10/2025
4.57.0- [`ttLib.__main__`] Add `--no-recalc-timestamp` flag (#3771) - [`ttLib.__main__`] Add `-b` (recalcBBoxes=False) flag (#3772) - [cmap] Speed up glyphOrder loading from cmap (#3774) - [`ttLib.__main__`] Improvements around the `-t` flag (#3776) - [Debg] Fix parsing from XML; add roundtrip tests (#3781) - [fealib] Support \*Base.MinMax tables (#3783, #3786) - [config] Add OPTIMIZE_FONT_SPEED (#3784) - [varLib.hvar] New module to add HVAR table to the font (#3780) - [otlLib.optimize] Fix crLow4/3/2025
4.56.0- [varStore] Sort the input todo list with the same sorting key used for the opimizer's output (#3767). - [otData] Fix DeviceTable's ``DeltaValue`` repeat value which caused a crash after importing from XML and then compiling a GPOS containing Device tables (#3758). - [feaLib] Make ``FeatureLibError`` pickleable, so client can e.g. use feaLib to can compile features in parallel with multiprocessing (#3762). - [varLib/gvar] Removed workaround for old, long-fixed macOS bug about composite glyphLow2/7/2025
4.55.8- [MetaTools] Fixed bug in buildUCD.py script whereby the first non-header line of some UCD text file was being skipped. This affected in particular the U+00B7 (MIDDLE DOT) entry of ScriptExtensions.txt (#3756).Low1/31/2025
4.55.7- Shorten the changelog included in PyPI package description to accommodate maximum length limit imposed by Azure DevOps. No actual code changes since v4.55.6 (#3754).Low1/28/2025
4.55.6- [glyf] Fixed regression introduced in 4.55.5 when computing bounds of nested composite glyphs with transformed components (#3752).Low1/27/2025
4.55.5- [glyf] Fixed recalcBounds of transformed components with unrounded coordinates (#3750). - [feaLib] Allow duplicate script/language statements (#3749).Low1/27/2025
4.55.4- [bezierTools] Fixed ``splitCubicAtT`` sometimes not returning identical start/end points as result of numerical precision (#3742, #3743). - [feaLib/ast] Fixed docstring of ``AlternateSubstStatement`` (#3735). - [transform] Typing fixes (#3734).Low1/21/2025
4.55.3- [Docs] fill out ttLib table section [#3716] - [feaLib] More efficient inline format 4 lookups [#3726]Low12/10/2024
4.55.2- [Docs] update Sphinx config (#3712) - [designspaceLib] Allow axisOrdering to be set to zero (#3715) - [feaLib] Don’t modify variable anchors in place (#3717)Low12/5/2024
4.55.1- [ttGlyphSet] Support VARC CFF2 fonts (#3683) - [DecomposedTransform] Document and implement always skewY == 0 (#3697) - [varLib] "Fix" cython iup issue? (#3704) - Cython minor refactor (#3705)Low12/5/2024
4.55.0- [cffLib.specializer] Adjust stack use calculation (#3689) - [varLib] Lets not add mac names if the rest of name doesn't have them (#3688) - [ttLib.reorderGlyphs] Update CFF table charstrings and charset (#3682) - [cffLib.specializer] Add cmdline to specialize a CFF2 font (#3675, #3679) - [CFF2] Lift uint16 VariationStore.length limitation (#3674) - [subset] consider variation selectors subsetting cmap14 (#3672) - [varLib.interpolatable] Support CFF2 fonts (#3670) - Set isfinal to true iLow11/14/2024
4.54.1- [unicodedata] Update to Unicode 16 - [subset] Escape `\` in doc stringLow9/24/2024
4.54.0- [Docs] Small docs cleanups by @n8willis (https://github.com/fonttools/fonttools/pull/3611) - [Docs] cleanup code blocks by @n8willis (https://github.com/fonttools/fonttools/pull/3627) - [Docs] fix Sphinx builds by @n8willis (https://github.com/fonttools/fonttools/pull/3625) - [merge] Minor fixes to documentation for merge by @drj11 (https://github.com/fonttools/fonttools/pull/3588) - [subset] Small tweaks to pyftsubset documentation by @RoelN (https://github.com/fonttools/fonttools/pull/36Low9/23/2024
4.53.14.53.1 - [feaLib] Improve the sharing of inline chained lookups (#3559) - [otlLib] Correct the calculation of OS/2.usMaxContext with reversed chaining contextual single substitutions (#3569) - [misc.visitor] Visitors search the inheritance chain of objects they are visiting (#3581)Low7/5/2024
4.53.0- [ttLib.removeOverlaps] Support CFF table to aid in downconverting CFF2 fonts (https://github.com/fonttools/fonttools/pull/3528) - [avar] Fix crash when accessing not-yet-existing attribute (https://github.com/fonttools/fonttools/pull/3550) - [docs] Add buildMathTable to otlLib.builder documentation (https://github.com/fonttools/fonttools/pull/3540) - [feaLib] Allow UTF-8 with BOM when reading features (https://github.com/fonttools/fonttools/pull/3495) - [SVGPathPen] Revert rounding coordinLow5/31/2024
4.52.4- [varLib.cff] Restore and deprecate convertCFFtoCFF2 that was removed in 4.52.0 release as it is used by downstream projects (#3535).Low5/27/2024
4.52.3Fixed a small syntax error in the reStructuredText-formatted NEWS.rst file which caused the upload to PyPI to fail for 4.52.2. No other code changes.Low5/27/2024
4.52.2- [varLib.interpolatable] Ensure that scipy/numpy output is JSON-serializable (#3522, #3526) - [housekeeping] Regenerate table lists, to fix pyinstaller packaging of the new `VARC` table (#3531, #3529) - [cffLib] Make CFFToCFF2 and CFF2ToCFF more robust (#3521, #3525)Low5/27/2024
4.52.1Fixed a small syntax error in the reStructuredText-formatted NEWS.rst file which caused the upload to PyPI to fail for 4.52.0. No other code changes.Low5/24/2024
4.52.0- Added support for the new ``VARC`` (Variable Composite) table that is being proposed to OpenType spec (#3395). For more info: https://github.com/harfbuzz/boring-expansion-spec/blob/main/VARC.md - [ttLib.main] Fixed decompiling all tables (90fed08). - [feaLib] Don't reference the same lookup index multiple times within the same feature record, it is only applied once anyway (#3520). - [cffLib] Moved methods to desubroutinize, remove hints and unused subroutines from subset module to cffLow5/24/2024
4.51.0- [ttLib] Optimization on loading aux fields (#3464). - [ttFont] Add reorderGlyphs (#3468).Low4/5/2024
4.50.0- [pens] Added decomposing filter pens that draw components as regular contours (https://github.com/fonttools/fonttools/pull/3460). - [instancer] Drop explicit no-op axes from TupleVariations (https://github.com/fonttools/fonttools/pull/3457). - [cu2qu/ufo] Return set of modified glyph names from fonts_to_quadratic (https://github.com/fonttools/fonttools/pull/3456).Low4/5/2024
4.49.0- [otlLib] Add API for building ``MATH`` table (#3446)Low2/16/2024
4.48.1- Fixed uploading wheels to PyPI, no code changes since v4.48.0.Low2/6/2024
4.48.0- [varLib] Do not log when there are no OTL tables to be merged. - [setup.py] Do not restrict lxml<5 any more, tests pass just fine with lxml>=5. - [feaLib] Remove glyph and class names length restrictions in FEA (#3424). - [roundingPens] Added ``transformRoundFunc`` parameter to the rounding pens to allow for custom rounding of the components' transforms (#3426). - [feaLib] Keep declaration order of ligature components within a ligature set, instead of sorting by glyph name (#3429). - [feaLow2/6/2024
4.47.2Minor release to fix uploading wheels to PyPI.Low1/11/2024
4.47.1- [merge] Improve help message and add standard command line options (#3408) - [otlLib] Pass ``ttFont`` to ``name.addName`` in ``buildStatTable`` (#3406) - [featureVars] Re-use ``FeatureVariationRecord``s when possible (#3413)Low1/11/2024
4.47.0- [varLib.models] New API for VariationModel: ``getMasterScalars`` and ``interpolateFromValuesAndScalars``. - [varLib.interpolatable] Various bugfixes and rendering improvements. In particular, add a Summary page in the front, and an Index and Table-of-Contents in the back. Change the page size to Letter. - [Docs/designspaceLib] Defined a new ``public.fontInfo`` lib key, not used anywhere yet (#3358).Low12/18/2023
4.46.0- [featureVars] Allow to register the same set of substitution rules to multiple features. The ``addFeatureVariations`` function can now take a list of featureTags; similarly, the lib key 'com.github.fonttools.varLib.featureVarsFeatureTag' can now take a comma-separateed string of feature tags (e.g. "salt,ss01") instead of a single tag (#3360). - [featureVars] Don't overwrite GSUB FeatureVariations, but append new records to it for features which are not already there. But raise ``VarLibError``Low12/2/2023
4.45.1- [varLib.interpolatable] Various bugfixes and improvements, better reporting, reduced false positives. - [ttGlyphSet] Added option to not recalculate glyf bounds (#3348). Low11/23/2023
4.45.0- [varLib.interpolator] Vastly improved algorithms. Also available now is ``--pdf`` and ``--html`` options to generate a PDF or HTML report of the interpolation issues. The PDF/HTML report showcases the problematic masters, the interpolated broken glyph, as well as the proposed fixed version.Low11/20/2023
4.44.3- [subset] Only prune codepage ranges for OS/2.version >= 1, ignore otherwise (#3334). - [instancer] Ensure hhea vertical metrics stay in sync with OS/2 ones after instancing MVAR table containing 'hasc', 'hdsc' or 'hlgp' tags (#3297).Low11/15/2023
4.44.2- [glyf] Have ``Glyph.recalcBounds`` skip empty components (base glyph with no contours) when computing the bounding box of composite glyphs. This simply restores the existing behavior before some changes were introduced in fonttools 4.44.0 (#3333).Low11/14/2023
4.44.1- [feaLib] Ensure variable mark anchors are deep-copied while building since they get modified in-place and later reused (#3330). - [OS/2|subset] Added method to ``recalcCodePageRanges`` to OS/2 table class; added ``--prune-codepage-ranges`` to `fonttools subset` command (#3328, #2607). NOTE: this release was "yanked" from PyPI because it introduced a regression: https://github.com/fonttools/fonttools/issues/3334Low11/14/2023

Dependencies & License Audit

Loading dependencies...

Similar Packages

azure-search-documentsMicrosoft Azure Cognitive Search Client Library for Pythonazure-template_0.1.0b6187637
apache-tvm-ffitvm ffi0.1.10
luqumA Lucene query parser generating ElasticSearch queries and more !1.0.0
torchaoPackage for applying ao techniques to GPU models0.17.0
banksA prompt programming language2.4.1