[fonttools/fonttools] e73e9a: [bezierTools] Preserve exact endpoints in splitQua...

0 views
Skip to first unread message

Cosimo Lupo

unread,
Sep 18, 2026, 10:08:06 AM (yesterday) Sep 18
to fontto...@googlegroups.com
Branch: refs/heads/main
Home: https://github.com/fonttools/fonttools
Commit: e73e9a239e983a03f207e8e6d616344b5ef57964
https://github.com/fonttools/fonttools/commit/e73e9a239e983a03f207e8e6d616344b5ef57964
Author: ihsandeniz <132747884+...@users.noreply.github.com>
Date: 2026-09-17 (Thu, 17 Sep 2026)

Changed paths:
M Lib/fontTools/misc/bezierTools.py
M Tests/misc/bezierTools_test.py

Log Message:
-----------
[bezierTools] Preserve exact endpoints in splitQuadraticAtT and splitCubicAtTC

Extends the fixup from #3743 to the two remaining AtT split functions: the
first segment starts exactly at the first control point and the last segment
ends exactly at the last one, instead of at a value a few ULPs away.

splitCubicAtTC is a generator, so instead of materialising the sequence it
holds one segment back, which keeps the iteration lazy and O(1) in memory.

Measured over 30000 random curves per function, before -> after:

splitQuadraticAtT 27036 deviating -> 0
splitCubicAtTC 29260 deviating -> 0
splitCubicAtT 0 -> 0 (already fixed in #3743)
splitCubicIntoTwoAtTC 0 -> 0 (unaffected)


Commit: c1022063bcb90e08a3c31efc9a0d9ba1533a4ce0
https://github.com/fonttools/fonttools/commit/c1022063bcb90e08a3c31efc9a0d9ba1533a4ce0
Author: Cosimo Lupo <cos...@anthrotype.com>
Date: 2026-09-18 (Fri, 18 Sep 2026)

Changed paths:
M Lib/fontTools/misc/bezierTools.py

Log Message:
-----------
[bezierTools] fold _splitCubicAtTC into splitCubicAtTC

splitCubicAtTC was the only caller, and folding the two generators together
puts pt4 in scope inside the loop, so the endpoint fixup becomes one
conditional on the segment that ends at t == 1 instead of holding a segment
back. The first segment needs no fixup at all: t1 is 0.0 for it, so
d1 == d == pt1 exactly.

As fast as main when qu2cu'ing Times New Roman with all_cubic (21108 splines,
94004 splitCubicAtTC calls), where the held-back version costs 5%.


Commit: f9a1e7c9895d70f15ba718893847b888e9788872
https://github.com/fonttools/fonttools/commit/f9a1e7c9895d70f15ba718893847b888e9788872
Author: Cosimo Lupo <cos...@anthrotype.com>
Date: 2026-09-18 (Fri, 18 Sep 2026)

Changed paths:
M Lib/fontTools/misc/bezierTools.py
M Tests/misc/bezierTools_test.py

Log Message:
-----------
[bezierTools] preserve exact endpoints in splitQuadratic and splitCubic too

The where/isHorizontal pair went through the same _split*AtT helpers and had
the same problem, so this finishes the set from #3742. One line each: they
only need the last segment fixed, since the first segment starts at t == 0
and so already begins exactly at pt1.


Commit: 7d8c9672e5159f7cbddd3a10207637fa9334fc06
https://github.com/fonttools/fonttools/commit/7d8c9672e5159f7cbddd3a10207637fa9334fc06
Author: Cosimo Lupo <cos...@anthrotype.com>
Date: 2026-09-18 (Fri, 18 Sep 2026)

Changed paths:
M Lib/fontTools/misc/bezierTools.py

Log Message:
-----------
[bezierTools] drop the no-op start fixups

The first segment always starts exactly at the first control point already:
t1 is 0.0 for it, so d1 == d == pt1 with no rounding. Only the last segment
ever needs fixing up, so #3743's start assignment never did anything.


Commit: 4a4138d72bc40d3b744cbac6b6d198204762b974
https://github.com/fonttools/fonttools/commit/4a4138d72bc40d3b744cbac6b6d198204762b974
Author: Cosimo Lupo <cos...@anthrotype.com>
Date: 2026-09-18 (Fri, 18 Sep 2026)

Changed paths:
M Lib/fontTools/misc/bezierTools.py
M Tests/misc/bezierTools_test.py

Log Message:
-----------
Merge pull request #4194 from ihsandeniz/fix/split-endpoint-robustness

[bezierTools] Preserve exact endpoints in splitQuadraticAtT and splitCubicAtTC


Compare: https://github.com/fonttools/fonttools/compare/39b9d782de25...4a4138d72bc4

To unsubscribe from these emails, change your notification settings at https://github.com/fonttools/fonttools/settings/notifications
Reply all
Reply to author
Forward
0 new messages