Support GSUB type 6 format 2 with nested single substitutions - #861
Open
mh0pe wants to merge 1 commit into
Open
Conversation
Execute parsed class-based chaining rules with ordered, position-aware nested single substitutions. Preserve first-match semantics across rules and subtables, including deliberate no-op rules. Add synthetic end-to-end coverage for backtrack and rule ordering, nonzero sequence indexes, extension lookups, and unsupported nested types. Co-authored-by: Wiltse Carpenter <61297711+wiltse439@users.noreply.github.com>
Author
|
Friendly maintainer ping @fdb @Connum — this is the focused GSUB type 6 format 2 extraction suggested during review of #816. It keeps the scope to nested single substitutions, fails explicitly for unsupported nested lookup types, and includes synthetic plus real-font coverage. I’d appreciate a review when time permits and am happy to adjust the scope. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds execution support for the GSUB chaining contextual substitution format that
the parser already exposes as lookup type 6, format 2.
The implementation:
classes through their separate class definitions;
earlier substitutions;
sequenceIndex, so only the targeted token is changed;rules;
extension wrappers.
The nested-lookup scope is intentionally limited to single substitutions. Other
nested lookup types fail explicitly rather than being silently skipped. Lookup
flag filtering remains a broader shaping-engine follow-up; both real-world
reproducers below use lookup flag 0 and nested type 1.
Motivation and Context
On current
master, the presence of a type 6 / format 2 subtable causesgetPath()andgetAdvanceWidth()to throw before coverage is even evaluated:This reproduces with both SF Hebrew Rounded and the current Google Fonts Roboto
variable font.
This is a focused extraction of the GSUB 6/2 portion of #816, following the
review suggestion there to split the GSUB work from unrelated variation
changes. Thanks to @wiltse439 for the original implementation work; the commit
also credits them as a co-author. This PR leaves the existing type 6 / format 3
path untouched, preserving the
sequenceIndexfix from #824.How Has This Been Tested?
npm test: 348 passing, including build, minified distributions, and sourcelint.
rules, ordered records, nonzero
sequenceIndexthrough token application,first matching nested and top-level subtables, extension wrappers, and
explicit unsupported-type errors.
i+ combining acute shapes to glyphs[636, 169];affinityrenders without throwing.results.
Screenshots (if appropriate):
Not applicable.
Types of changes
Checklist:
npm run testand all tests passed green (including code styling checks).