Skip to content

Take the morx end-of-text transition (#144, #147, #151) - #434

Merged
blikblum merged 2 commits into
foliojs:masterfrom
iliev-blnk:morx-eot
Oct 31, 2026
Merged

blikblum merged 2 commits into
foliojs:masterfrom
iliev-blnk:morx-eot

Conversation

@iliev-blnk

Copy link
Copy Markdown
Contributor

Fixes #144, fixes #147, fixes #151

Cause

AATStateMachine.process looks up the entry for the end-of-text class and moves to its new state, but never passes the entry to the subtable. So the actions a font puts on its end-of-text transitions are dropped:

Fix

The state machine now passes the end-of-text entry to the subtable with a null glyph, and still never stays at the end of the text, whatever DontAdvance says. Each subtable then follows HarfBuzz, which matches CoreText here:

#433 this PR HarfBuzz 15.0.0
MORX-10 ABABAB A B A B A B A B A B B A A B A B B A
MORX-11 BABBAABX B A B B A A B X B A B B A X A B B A B B A X A B
MORX-17 AB A B B A B A
MORX-20 ABCDE A B C D E A B C.alt D E.alt1 A B C.alt D E.alt1
MORX-20 AE A E A.alt E.alt1 A.alt E.alt1

Across all 174 MORT/MORX cases of text-rendering-tests, this goes from 131 to 139 passing on top of #433: MORX-10, MORX-11, MORX-17 and the five failing MORX-20 cases. No other results change.

This builds on #433, because the rearrangement cases need its MarkLast clamp. Only the last commit is new here.

Tests

  • test/issues.js: MORX-10, MORX-11, MORX-17 and all seven MORX-20 inputs. All three tests fail without the fix.
  • The test fonts are TestMORXTen.ttf, TestMORXEleven.ttf, TestMORXSeventeen.ttf and TestMORXTwenty.ttf from text-rendering-tests, added to test/data/fonttest/ under the Apache License 2.0 in test/data/fonttest/LICENSE.txt.
  • npm test: 715 passing. npm run format:check passes.

…#142, foliojs#143)

Skip a rearrangement verb when nothing has been marked yet or when the
marked range is shorter than the glyphs the verb moves, like CoreText and
HarfBuzz. Clamp the end of the range at the end of the text.
@blikblum
blikblum merged commit 64f9e0f into foliojs:master Oct 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants