Skip to content

Rearrange morx glyphs only within a long enough marked range (#142, #143) - #433

Open
iliev-blnk wants to merge 1 commit into
foliojs:masterfrom
iliev-blnk:morx-rearrangement
Open

iliev-blnk wants to merge 1 commit into
foliojs:masterfrom
iliev-blnk:morx-rearrangement

Conversation

@iliev-blnk

Copy link
Copy Markdown
Contributor

Fixes #142, fixes #143

Cause

processIndicRearragement runs the verb of every entry on whatever range firstGlyph..lastGlyph holds at that moment:

Fix

This follows HarfBuzz, which matches CoreText here:

  • A verb runs only when a range is marked and it holds every glyph the verb moves (1 for Ax => xA, up to 4 for ABxCD => DCxBA). Without MarkFirst, the range starts at the first glyph.
  • MarkLast at the end of the text marks the last glyph, as HarfBuzz clamps end to the buffer length.
master this PR HarfBuzz 15.0.0
MORX-3 ABXCD4 X C D A B four A B X C D four A B X C D four
MORX-5 PQRAXYZ⓬ P Q Y Z X R A one_two P Q R A X Y Z one_two P Q R A X Y Z one_two
MORX-5 PQRABCXYZ⓯ P Q R C X A B Y Z one_five P Q R A B C X Y Z one_five P Q R A B C X Y Z one_five

Across all 174 MORT/MORX cases of text-rendering-tests, this PR goes from 93 to 131 passing: all 13 failing MORX-3 cases and all 25 MORX-5 cases. No other results change.

A rearrangement subtable with the reverse-direction flag marks its first glyph after its last one, so it now leaves the glyphs alone. Before, it spliced with a negative range length. None of the test fonts uses one. Supporting them properly, like HarfBuzz does by reversing the buffer, would be a separate change.

Tests

  • test/issues.js: four MORX-3 inputs and four MORX-5 inputs. Both tests fail on master.
  • The test fonts are TestMORXThree.ttf and TestMORXFour.ttf from text-rendering-tests, added to test/data/fonttest/ under the Apache License 2.0 in test/data/fonttest/LICENSE.txt.
  • npm test: 712 passing. npm run format:check passes.

This is independent of #428, #429, #430 and #432.

…#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.
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.

[morx] Rearrangement underflow [morx] Rearrangement without marked sequence

1 participant