Skip to content

Give an Arabic joining form's plain context rule no backtrack or lookahead (#189) - #215

Merged
jakejackson1 merged 2 commits into
gravitypdffrom
recover/189-context-rule-sequences
Sep 17, 2026
Merged

jakejackson1 merged 2 commits into
gravitypdffrom
recover/189-context-rule-sequences

Conversation

@jakejackson1

Copy link
Copy Markdown
Member

Closes #189.

This carries PR #196's change to gravitypdf. #196 was merged into its stacked base branch after that branch had already been squash-merged into gravitypdf, so its commits never reached gravitypdf and #189 stayed open. The commits are #196's own, replayed with git rebase --onto and patch-for-patch identical per git range-diff. See #196 for the full description, measurements and review.

🤖 Generated with Claude Code

jakejackson1 and others added 2 commits September 17, 2026 12:48
…ahead (#189)

A Type 5 rule has an input sequence and nothing else, but where it belonged to an Arabic
joining form and was Format 1 or 2 the parser handed the shaper $backtrackGlyphs and
$lookaheadGlyphs for its prel and postl. Type 5 never sets either, so the rule got the
sequences of the last chained rule read for the script, and Shaper\Arabic gave the form only
where the text also held that unrelated rule's context. Format 3 already gave both empty.

The 5.1 and 5.2 calls no longer pass contextRule() those sequences, which was the only use of
its $arabic parameter, so the parameter goes and the entry an Arabic form's rule becomes
reads the rule's own backtrack and lookahead. Every branch of the walk that reads the two
variables now sets them first, so their initialisation goes too.

No font in tests/data/ttf reaches this, and regenerating every golden master from cold moves
none of them. NotoSansArabic-GSUB5Form-Synthetic makes it visible: it is
NotoSansArabic-Joining-Subset (Noto Sans Arabic 2.012, OFL 1.1) with its GSUB replaced, in
fontTools 4.59.2, by a 'fina' Type 6 Format 3 giving beh its dotless final form after beh and
before low alef, then an 'init' Type 5 Format 1 and a 'medi' Type 5 Format 2 giving the
dotless initial and medial forms, and name IDs 1, 4 and 6 renamed. Before, both Type 5 rules
asked for beh before and low alef after, so beh beh drew no initial form and beh beh beh
low-alef no initial or medial one. hb-shape 14.3.1 draws both forms, as mPDF now does, and
the font's shaping master draws the initial form before the tatweel.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Type 6 Format 1 was the last branch holding its backtrack and lookahead in walk-wide
variables it did not need, the shape #189 came from; the other chained branches take theirs
from coverageSequences() or classSequences().

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jakejackson1 jakejackson1 added bug Something isn't working create-upstream-pr labels Sep 17, 2026
@jakejackson1
jakejackson1 merged commit 1dc51b1 into gravitypdf Sep 17, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working create-upstream-pr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The parser hands an Arabic form's plain context rule the backtrack and lookahead of the last chained rule it read

1 participant