Branch: refs/heads/main
Home:
https://github.com/fonttools/fonttools
Commit: 1f8f20a5cf8e816e77c27ba2029ad4a95f4de449
https://github.com/fonttools/fonttools/commit/1f8f20a5cf8e816e77c27ba2029ad4a95f4de449
Author: Sanjay Santhanam <
51058514+S...@users.noreply.github.com>
Date: 2026-07-03 (Fri, 03 Jul 2026)
Changed paths:
M Lib/fontTools/svgLib/path/parser.py
M Tests/svgLib/path/parser_test.py
Log Message:
-----------
[svgLib.path] Don't crash on a redundant closepath (Z Z)
parse_path() raised a cryptic "AttributeError: 'NoneType' object has
no attribute 'real'" on any path with two consecutive closepath
commands, e.g. "M0,0 L1,1 Z Z" or "M0,0 Z Z".
Root cause: closing a subpath ("Z") sets start_pos = None to mark that
there is no open subpath. A following "Z" then re-enters the same
branch where the guard `current_pos != start_pos` compares a complex
number against None (always True), so it calls
`pen.lineTo((start_pos.real, start_pos.imag))` on start_pos == None.
A redundant closepath with no open subpath is valid per the SVG path
grammar (drawto-commands permits repeated closepath) and browsers
render it identically to a single Z. Guard the whole close-path body on
`start_pos is not None` so a redundant Z is a no-op instead of a crash;
`command` is still reset either way. Non-redundant Z behaviour is
unchanged.
Added parametrized regression cases for "z z" after a real subpath and
after an empty (moveto-only) closed subpath; both crash without the fix.
Commit: d34426df42a3e19b50b85a6375256e62fc36930d
https://github.com/fonttools/fonttools/commit/d34426df42a3e19b50b85a6375256e62fc36930d
Author: Cosimo Lupo <
cos...@anthrotype.com>
Date: 2026-08-20 (Thu, 20 Aug 2026)
Changed paths:
M Lib/fontTools/svgLib/path/parser.py
M Tests/svgLib/path/parser_test.py
Log Message:
-----------
Merge pull request #4122 from Sanjays2402/fix/svg-redundant-closepath
[svgLib.path] Don't crash on a redundant closepath (Z Z)
Compare:
https://github.com/fonttools/fonttools/compare/e18b63cbf929...d34426df42a3
To unsubscribe from these emails, change your notification settings at
https://github.com/fonttools/fonttools/settings/notifications