diff --git a/src/symbol/shaping.ts b/src/symbol/shaping.ts index 379f158e2f1..2afc2f4ad12 100644 --- a/src/symbol/shaping.ts +++ b/src/symbol/shaping.ts @@ -533,8 +533,10 @@ export function determineLineBreaks( let graphemeIndex = 0; for (const {index: wordIndex, segment: word} of wordSegmenter.segment(logicalInput.text)) { const graphemes = splitByGraphemeCluster(word); + let section; for (const grapheme of graphemes) { - const section = logicalInput.getSection(graphemeIndex); + // Grapheme cluster could be split across a word boundary. Fall back to the last known section. + section = logicalInput.getSection(graphemeIndex) || section; if (!!grapheme.trim()) { currentX += getGlyphAdvance(grapheme, section, glyphMap, imagePositions, spacing, layoutTextSize); }