Skip to content

[fea-rs] Allow NULL anchor without mark class in pos ligature rules#2015

Merged
anthrotype merged 2 commits into
mainfrom
fix-null-anchor-ligature
May 18, 2026
Merged

[fea-rs] Allow NULL anchor without mark class in pos ligature rules#2015
anthrotype merged 2 commits into
mainfrom
fix-null-anchor-ligature

Conversation

@anthrotype
Copy link
Copy Markdown
Member

Part of #2014.

In GPOS type 5 (mark-to-ligature) rules, <anchor NULL> denotes a ligature component with no mark attachment point. fea-rs required mark @class after every anchor, rejecting <anchor NULL> on non-final components followed by ligComponent.

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>; without mark @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 mark follows, skip mark-class parsing. Non-NULL anchors without mark still error as before.

…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.
@anthrotype
Copy link
Copy Markdown
Member Author

@anthrotype anthrotype added this pull request to the merge queue May 18, 2026
Merged via the queue into main with commit 5f61d66 May 18, 2026
12 of 13 checks passed
@anthrotype anthrotype deleted the fix-null-anchor-ligature branch May 18, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants