pypi / fonttools
fonttools
What changed in fonttools 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-26.
34 breaking10 security2 deprecations25 new APIs and options2 performance12 behavior and defaults7 tooling109 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initfonttools 4201 changes
Breaking changes 34
woff now requires brotli >= 1.2.1, which fixes GHSA-9v8h-qqgm-4m35.
The instancer rounds CFF2 outlines and stem hints on absolute positions rather than per relative operand.
Unclosed OS/2, BASE or STAT table blocks now raise FeatureLibError instead of looping forever.
The instancer now raises an error for conditions in unsupported formats instead of silently dropping them.
Raises TTLibError when composite glyphs exceed 65535 points.
Variable-font overrides of some public.fontInfo keys are merged with root-level font info instead of replacing it.
Bounds-checks count and offSize on read, raising TTLibError instead of allocating huge lazy lists.
Fixes format 2 compilation edge cases, rejects glyph IDs above 65535 in formats 2 and 4, splits long format 14 default UVS ranges, and round-trips empty formats 12 and 13.
Prefers the Windows English name over the Mac name.
Raises NotImplementedError for an all-off-curve cubic contour, which the point pen protocol cannot express.
Rejects in-place union with |=.
Raises ValueError instead of IndexError for a truncated path command.
Updates the variation-store binary format; VARC fonts built with earlier fontTools versions must be rebuilt.
When splitting a DesignSpace v5 document with makeNames=True, explicitly set family and style names take precedence over names computed from STAT labels in all languages; an instance with its own style name no longer gets a PostScript name made from…
Decompiling a format 4 subtable with an idRangeOffset outside glyphIndexArray now raises TTLibError instead of silently mapping to the wrong glyph or raising a bare AssertionError.
Entity resolution is disabled altogether on lxml 5.0 and later to prevent crafted DTDs from reading local files into parsed XML content.
Python 3.10 support is dropped; fontTools now requires Python 3.11 or later.
When unicodedata2 is used, version 18.0.0 is required.
The instancer rejects pinning or restricting axes referenced by VARC components.
Redundant script statements now track script and language correctly, narrow language systems, terminate the current lookup, and leave lookupflag unchanged, matching makeotf.
Conflicting duplicate inputs in axis maps are rejected instead of silently keeping the last one.
Raises TTLibError for a truncated or out-of-bounds cmap subtable header.
COLRv0 layers and COLRv1 PaintGlyph or PaintColrGlyph references to missing glyphs now produce a legible error.
An unrecoverable LookupList overflow now produces an actionable error.
Raises TTLibError instead of RecursionError when a composite-component reference cycle is encountered.
Reading a font truncated within the table directory or a table entry raises TTLibError instead of AssertionError or struct.error.
Rejects non-positive tolerances and validates curve inputs and list lengths.
Removes support for the defunct Adobe SING Glyphlet tables META, SING, GMAP, and GPKG.
Rejects non-positive tolerances and validates curve inputs and list lengths.
Raises an error when condition sets have the same name.
Support for EOL Python 3.9 has been dropped.
Raises an error when rsub has a NULL target.
Updates Unicode data to Unicode 17; installations with the unicode extra require unicodedata2 >= 17.0.0.
The v4.x series requires Python 3.6 or greater; use fonttools 3.x if Python 2 support is needed.
Security 10
Expansion of format 4 segments and format 12/13 groups is bounded; out-of-range, inverted, overlapping, and missing-glyph groups are handled without unbounded expansion.
Escapes axis names and tags in emitted designspace snippets to prevent crafted fonts from injecting markup.
The command line strips directory components from variable-font names when deriving output filenames, preventing a designspace from writing outside the output directory.
Escapes the ]]> terminator inside CDATA sections, preventing an SVG document from smuggling markup through a TTX round trip.
Rejects paths resolving outside the filesystem root, preventing malicious UFO contents.plist paths or crafted .ufoz archives from reading or writing outside the intended location.
Sanitises glyph names used as filenames when exporting EBDT/CBDT data, preventing arbitrary file writes from untrusted fonts.
Does not resolve external XML entities when lxml is used, preventing XXE file disclosure on lxml versions before 5.0.
Replaces eval() with safeEval() to prevent arbitrary code execution from crafted TTX files.
Uses only basename(vf.filename) to prevent path traversal when invoked from code; the same protection applies to the varLib command-line script.
Backports the security fix for CVE-2025-66034 while retaining Python 3.9 support, allowing downstream projects still on Python 3.9 to receive the fix.
Deprecations 2
This module now only re-exports enum.StrEnum and is deprecated.
The module is deprecated after its Python 2-only code was removed; it will be removed in the future.
New APIs and options 25
Adds the keyword-only resetUnspecifiedAxes pen argument for passing RESET_UNSPECIFIED_AXES while keeping addVarComponent() locations sparse.
Adds support for uppercase companion tables, extended layout, FeatureVariations 1.1, TTC 1.1/2.1 and DMAP, including in FontBuilder, merge, subset, instancer, qu2cu, removeOverlaps and scaleUpem.
Adds a module and CLI for beyond-64k tables in the final ISO Open Font Format 5th edition, with support across fontTools operations.
Adds a keyword-only argument to support decreasing design-space axis mappings.
Adds support for instancing variable COLRv1 fonts.
Allows requesting an axis's original range on VARC fonts.
A new axisCount element provides the axis count when gvar data is processed without fvar.
The new languages attribute contains all language tags in a LanguageStatement; language remains the first tag.
Static VARC fonts can omit fvar while retaining gvar or CFF2 component-internal variation data; hidden axes are addressed by index, and gvar supports compilation, decompilation, and TTX round-tripping without fvar.
The glyf table now provides an items method, making it more dict-like.
The glyf table now supports iteration, making it more dict-like.
The glyf table now provides a values method, making it more dict-like.
Adds support for legacy Apple bitmap-only font tables bhed, bdat, bloc, head variants, EBDT, and EBLC.
Adds support for the Embedded Bitmap Scaling table.
Glyph-to-group construction is accessible outside of its lookup function.
Adds semantic decompilation, TTX, and compilation support for rearrangement, contextual-substitution, ligature, and insertion subtables.
Implements splitting a single positioning lookup so GPOS lookup type 1 offset overflows can be recovered.
Adds support for TrueType Collection version 2.
Adds a shorthand for the value at the default location, such as (100 wght=900:120), equivalent to specifying the default wght value explicitly.
Adds support for the Apple Color Emoji bgcl table.
Introduces a dataclass for OpenType table schema definitions, replacing raw tuples in otData.py.
Adds support for the Incremental Font Transfer IFT table.
Adds support for the IFTX table with PatchMapFormat2.
Adds a command for comparing font files.
Adds the --remove-overlaps option.
Performance 2
Fixes exponential running time on composite glyphs that reuse the same component at several nesting levels.
Uses a reverse glyph map for O(1) membership checks in __setitem__.
Behavior and default changes 12
Accepts flattened per-region vector tuples.
Supports merging fonts that both have a MATH table.
Warns when a source or instance is dropped because it lies outside the document's own axes.
feaLib supports listing multiple language tags; following rules and lookup references are registered under every listed language, and dflt cannot be combined with other tags.
When --flavor is omitted, pyftsubset preserves the input font's WOFF or WOFF2 flavor; use --flavor=none to force uncompressed output.
When all contextual formats overflow, the ruleset is split in halves until it fits.
The variable-font instancer can now instance the BASE table.
East Asian spacing palt is kept by default during subsetting.
Cython extensions are declared free-threading compatible on Python 3.13+, so importing them on free-threaded Python no longer re-enables the GIL.
Contextual rule merging now covers single substitutions, GSUB/GPOS named lookups, ignore rules, and chained alternate substitutions.
Chained multi substitution rules with the same context are merged into one subtable instead of producing one subtable per glyph.
Adds support for --remove-overlaps with fonts that have a CFF2 table.
Tooling 7
Support for Python 3.15 is explicitly tested and declared.
TTX output shows name table strings as comments next to label IDs, matching the convention used by fvar, STAT, and trak.
Adds typing annotations for DefaultTable.
Adds typing annotations for DSIG.
Adds typing annotations for ttProgram.
Explicitly declares support for Python 3.14.
Adds typing annotations to ttFont, xmlWriter, sfnt, varLib.models and other modules.
Fixes and other changes 109
Writing a .ufoz or other non-.zip archive no longer overwrites an unrelated sibling .zip.
Escapes double quotes and backslashes when writing names from FeatureNameStatement, STATNameStatement and CVParametersNameStatement.
Arrays using more than one blend group are now preserved.
Blend values retain full precision until they are written back.
Fixes an AttributeError when updating names in fonts with a version 1.0 STAT table by falling back to the subfamily name.
scaleUpem now also scales MATH lengths that are not MathValueRecords.
Fixes operand miscounting when several blend operators precede the first stem or moveto.
CFF2 decompiling, specializing and instancing charstrings now inherit the initial vsindex from the Private DICT.
Omitted range attributes on a DesignSpace v5 axis subset are taken from the parent axis.
Corrects BCP 47 tags for some Mac and Windows language IDs.
Deleting a CFF dict attribute now actually removes it.
Reads CFF font names as Latin-1, matching how they are written.
Preserves operands when a blend has zero regions.
Normalizes mapped-axis bounds and rule conditions from their original values.
Keeps glyph metrics after probing a missing attribute.
Rejects duplicate use of a mark class in one anchor list, handles value records with all-NULL devices, and pads a short OS/2 Vendor with spaces.
Invalid BASE, UnicodeRange, name, STAT location, and OS/2 Vendor inputs now raise FeatureLibError with a source location instead of a bare Python error.
Fixes size, ssXX, and cvXX FeatureParams in FeatureVariations alternate feature tables so they compile and round-trip.
Adding rvrn shifts lookup indices inside existing FeatureVariations; null offsets are handled and substitution records stay sorted after merging.
The subsetter handles a null GDEF variation store.
The instancer CLI raises ValueError with a missing fvar table message for a static font instead of a bare KeyError.
Folds, removes, or remaps MATH VariationIndex devices when instancing, subsetting the GDEF store, or optimizing it.
Fixes tokenizing escaped parentheses in PostScript strings.
Preserves the direction of the remaining axis when decomposing a transform whose first column is zero.
Closes owned input streams when parsing fails.
Handles empty packed deltas when this setting is enabled.
Avoids a crash on a format 2.0 table with numGlyphs set to 0.
Recursive decompilation fully decodes lazily loaded ligatures, SinglePos, and PairPos arrays, preventing corruption or assertions on lazy fonts.
Passes the all-off-curve None sentinel through.
Scales per-glyph VORG origins, fixes VARC scaling for static fonts and condition variations, and avoids mutating the shared default CFF FontMatrix.
Fixes compiling a Silf table decompiled from binary.
Returns NotImplemented for unsupported types.
Fixes cubic off-curve detection across contour starts.
Computes glyph width lazily for glyf variable fonts without HVAR, making width correct before drawing.
Fixes component conditions, implicit scaleY import, reported coordinates after axis resets, and inherited coordinates when drawing CFF2 components.
Applies VVAR vertical-origin deltas to VORG and uses OpenType rounding for instanced advances and vertical origins.
Keeps a universal FeatureVariations record when pinning removes its last condition but other axes remain.
Preserves ppem Device corrections in GDEF, BASE, GPOS, and JSTF instead of asserting on them.
Respects designspace source layers and fixes --json output with SciPy.
Raises ValueError with a missing fvar table message for a static font instead of a bare KeyError.
Recomputes numRecs and numRatios when compiling.
Preserves minorVersion when copying flavor data.
Can be called more than once.
Compiling succeeds when the lowest glyph ID in a lead-byte row is 32768 or higher, instead of failing with struct.error.
The instancer no longer culls avar2 ranges for component-internal variations that can reach outside font-level ranges.
The VarStore is always recompiled when saving, preventing stale data when a font is modified in place after an earlier save.
Its type annotation and documentation now correctly specify that it holds a SourceDescriptor, not a source name.
A STAT table block missing ElidedFallbackName or ElidedFallbackNameID now raises FeatureLibError instead of UnboundLocalError.
Collinear vertical lines are treated as parallel, avoiding ZeroDivisionError.
Repeated script/language pairs within a feature block no longer replace the language system's lookups with a fresh copy of the defaults.
Preserves exact endpoints when splitting a cubic curve.
Preserves exact endpoints when splitting a quadratic curve.
Inconsistent WOFF table, metadata, or private-data lengths raise TTLibError instead of AssertionError, including under python -O.
Bundled script, script extension, block, and bidi-mirroring tables are updated to Unicode 18.0.0.
Merge reports incompatible unitsPerEm values by name and includes the input values instead of raising a bare assertion.
The instancer fixes stale VARC axis references after removing an unrelated axis.
Drawing VARC components with a negated condition (format 5) no longer raises AttributeError.
Tags containing regex metacharacters are now matched literally when scanning for an anonymous block terminator.
Offset overflows now raise OTLOffsetOverflowError instead of AttributeError, allowing another contextual format to be tried.
Glyph names are escaped in the interpolatable HTML report.
Adjusts the avar version 2 ItemVariationStore during partial instancing so remaining axes behave the same after limiting the designspace.
Preserves subtables in unsupported formats when compiling or dumping a font read from binary.
Empty Macintosh format 2 subtables now round-trip.
Reads an empty <lib> element as an empty lib instead of raising IndexError.
Fixes name-table parsing for multibyte Mac encodings.
No longer reports success when it has not promoted a lookup to Extension, so unresolvable overflows are not masked.
TrueType assembly following IDEF is indented like function definitions.
No longer crashes when instancing CFF2 fonts without a VariationStore.
Fixes Private-dict vsindex handling when instancing CFF2.
Subsetting no longer keeps constructions for glyphs added only during MATH closure.
Checks fsSelection/macStyle consistency against bhed as well as head.
Fixes a TypeError in the Cython-compiled build when tuple splines are passed.
Fixes a crash parsing an SVG path with consecutive closepath commands.
Suppresses spurious close segments caused by floating-point drift in relative path commands.
Starts a new subpath at the just-closed subpath's initial point when a drawto command follows a closepath, per SVG spec.
Uses a single head.modified timestamp across a collection save.
Subsetting collects and remaps variation indices referenced by condition tables and drops AxisIndicesList, ConditionList, and MultiVarStore when empty.
Fixes many-to-one (flat-segment) axis maps silently dropping entries via dict comprehension.
Accepts reserved bits 123-127, restoring round-trip with getUnicodeRanges and fixing a recalcUnicodeRanges crash in the subsetter.
Fixes a Cython complex-division rounding difference that could cause ±1 off-curve coordinate shifts.
Validates map CLI coordinates.
Preserves the existing name table during build.
Fixes a Python 3 TypeError when subtables share an encoding record and validates encoding-record uniqueness at compile time.
Raises a clear ColorLibError when base glyphs are missing from glyphMap instead of a confusing KeyError.
Passes location to fix glyphsLib round-tripping.
Writes 0xFFFF instead of 0 for missing nameIDs in feature parameters.
Forwards extrapolate and axisRanges, and checks location uniqueness after stripping zeros.
Fixes reading glyph outlines when glyphObject is None.
Fixes a regression with empty table lists.
Removes a duplicate final point on closePath only when it is an on-curve point.
Skips comments and processing instructions when drawing SVG paths.
Relaxes guideline validation to follow the updated spec.
Keeps return types consistent.
Fixes the --variable-fonts filter in build_many.
Fixes interpolation with non-linear avar mappings and allows use with designspace data before compilation.
Fixes axis ordering and iterative delta rounding to match fontc behavior.
Fixes node type assignment, kink detection, CFF2 vsindex parsing, glyph existence checks, and plot helpers.
Fixes a bug in avar2 full instancing.
Returns an empty Coverage instead of None when there is no coverage.
Preserves empty conditionsets when serializing designspaces to XML.
Fixes global pollution of FontBuilder setupOS2() default parameters.
BaseLangSysRecords are now sorted by tag.
Skips processing empty glyphs, supporting sparse kerning masters.
Fixes a logic bug in curveCurveIntersections.
Glyph names are now ensured to be unique.
The feature parser now correctly handles octal numbers.
The glyf table can be incomplete when dumping to XML.
Fixed an UnboundLocalError when loca or glyph tables are empty.
Fixed a KeyError when sorting masters if an axis has no on-axis masters.