Skip to content

Commit

Permalink
Fixed error rendering Burmese text
Browse files Browse the repository at this point in the history
Fixed an uncaught exception determining line break opportunities in Burmese text where a word is split down the middle at a word boundary.
  • Loading branch information
1ec5 committed Aug 28, 2024
1 parent 29de7cc commit abdb9c4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/symbol/shaping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit abdb9c4

Please sign in to comment.