[fea-rs] Allow NULL anchor without mark class in pos ligature rules#2015
Merged
Conversation
…re rules Good test: `<anchor NULL>` on a non-final ligature component followed by `ligComponent` should parse without errors (feaLib accepts this). Bad test: a non-NULL anchor without `mark @class` should still error. The good test currently fails — fea-rs rejects `<anchor NULL>` without `mark @class` even though the spec example and feaLib both allow it. Part of #2014.
In GPOS type 5 (mark-to-ligature) rules, `<anchor NULL>` denotes a ligature component with no mark attachment point. The `mark @class` that normally follows an anchor is not required in this case — the spec example shows `<anchor NULL>;` at the end of a rule, and feaLib has accepted bare `<anchor NULL>` (without mark) since its original GPOS type 5 implementation (fonttools/fonttools@0532ec85, Dec 2015). Previously, fea-rs required `mark @class` after every non-semicolon anchor, causing parse errors when `<anchor NULL>` appeared on a non-final ligature component (followed by `ligComponent` rather than `;`). This broke real-world fonts like Google Sans Arabic. The fix peeks at the anchor before consuming it: if it is NULL and no `mark` keyword follows, skip the mark-class parsing. Non-NULL anchors still require `mark @class` as before. Part of #2014.
Member
Author
|
For reference, this is feaLib's equivalent: |
rsheeter
approved these changes
May 18, 2026
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.
Part of #2014.
In GPOS type 5 (mark-to-ligature) rules,
<anchor NULL>denotes a ligature component with no mark attachment point. fea-rs requiredmark @classafter every anchor, rejecting<anchor NULL>on non-final components followed byligComponent.The FEA spec grammar says
<anchor> mark <named mark class>for each attachment, but the spec's own GPOS type 5 example uses<anchor NULL>;withoutmark @class. feaLib has followed the example rather than the grammar since its original GPOS type 5 implementation (Dec 2015).The fix peeks at the anchor before consuming it: if NULL and no
markfollows, skip mark-class parsing. Non-NULL anchors withoutmarkstill error as before.