Skip to content

Commit

Permalink
Fixed vertical text advance
Browse files Browse the repository at this point in the history
Fixed an issue where vertical CJK text was shifted upwards by one em.
  • Loading branch information
1ec5 committed Aug 27, 2024
1 parent 2748f1b commit 29de7cc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/symbol/shaping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -715,8 +715,9 @@ function shapeLines(shaping: Shaping,
x += metrics.advance * section.scale + spacing;
} else {
shaping.verticalizable = true;
positionedGlyphs.push({glyph: grapheme, imageName, x, y: y + baselineOffset, vertical, scale: section.scale, fontStack: section.fontStack, sectionIndex, metrics, rect});
x += verticalAdvance * section.scale + spacing;
const advance = verticalAdvance * section.scale + spacing;
positionedGlyphs.push({glyph: grapheme, imageName, x: x + advance, y: y + baselineOffset, vertical, scale: section.scale, fontStack: section.fontStack, sectionIndex, metrics, rect});
x += advance;
}

i++;
Expand Down

0 comments on commit 29de7cc

Please sign in to comment.