fix(textkit): fix glyphIndexAt regression#3369
Conversation
Adapt advanceWidthBetween to new glyphIndexAt semantics from diegomura#3358. The refactored glyphIndexAt uses reverse-loop search instead of direct array lookup, requiring callers to use `end - 1` (as slice.ts was updated). advanceWidthBetween was missed, causing width=0 for characters at run boundaries when scriptItemizer splits CJK text by script (Han/Hiragana/ Katakana). This broke text wrapping for any multi-script text.
🦋 Changeset detectedLatest commit: 1c48732 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Good catch. Wonder if we should fix |
glyphIndexAt now returns glyphIndices.length when the string index is beyond all glyph mappings, restoring the old fallback behavior. This removes the need for callers to pass end - 1 as a workaround. advanceWidthBetween is reverted to its original calling convention.
|
@diegomura Ah, ok. Fixed |
|
I have (I think?) a similar issue - my issue is with rendering Arabic, but the bug seems to also be in I get an error like Minimal example to reproduce: I'm not sure if the change proposed here will fix my issue. For anyone else with the same issue as me: downgrading to |
AdaptadvanceWidthBetweento newglyphIndexAtsemantics from #3358.Fix
glyphIndexAtregression from #3358.advanceWidthBetweenwas missed, causing width=0 for characters at run boundaries when scriptItemizer splits CJK text by script (Han/Hiragana/ Katakana). This broke text wrapping for any multi-script text.Found this regression while working on #3288