[fonttools/fonttools] 090376: Reuse and merge chained alternate subst lookups

0 views
Skip to first unread message

Cosimo Lupo

unread,
Mar 13, 2026, 7:49:42 AMMar 13
to fontto...@googlegroups.com
Branch: refs/heads/merge-chained-rules
Home: https://github.com/fonttools/fonttools
Commit: 0903764f84a971c1b4854ffabdf7a266000f5db9
https://github.com/fonttools/fonttools/commit/0903764f84a971c1b4854ffabdf7a266000f5db9
Author: Cosimo Lupo <cl...@google.com>
Date: 2026-03-13 (Fri, 13 Mar 2026)

Changed paths:
M Lib/fontTools/feaLib/builder.py
M Lib/fontTools/otlLib/builder.py
M Tests/feaLib/builder_test.py
A Tests/feaLib/data/contextual_merge_alternate.fea
A Tests/feaLib/data/contextual_merge_alternate.ttx

Log Message:
-----------
Reuse and merge chained alternate subst lookups

Add find_chainable_alternate_subst() to find an existing AlternateSubst
lookup that can accommodate a new glyph without conflict. This allows
consecutive chained alternate rules to share a single nested lookup and
merge into one contextual rule via _merge_contextual_rule().

Previously each chained alternate rule unconditionally created a fresh
AlternateSubstBuilder, preventing both lookup reuse and rule merging.


Commit: 8060f6a1ae4e4077e5021d48a5f0e54c72d27151
https://github.com/fonttools/fonttools/commit/8060f6a1ae4e4077e5021d48a5f0e54c72d27151
Author: Cosimo Lupo <cl...@google.com>
Date: 2026-03-13 (Fri, 13 Mar 2026)

Changed paths:
M Lib/fontTools/feaLib/builder.py

Log Message:
-----------
Rename _merge_contextual_rule to _add_contextual_rule

Fold the append logic into the method so callers don't need to
duplicate the fallback path


Compare: https://github.com/fonttools/fonttools/compare/bbdcfc20f4e0...8060f6a1ae4e

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