Skip to content

Commit

Permalink
Merge pull request #13 from yorickshan/fix/2938
Browse files Browse the repository at this point in the history
fix: vertical text alignment fix #3151
  • Loading branch information
yorickshan authored Jul 8, 2024
2 parents 90a981f + 92f6a33 commit f2ae901
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/render/canvas/canvas-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export class CanvasRenderer extends Renderer {
switch (paintOrderLayer) {
case PAINT_ORDER_LAYER.FILL:
this.ctx.fillStyle = asString(styles.color);
this.renderTextWithLetterSpacing(text, styles.letterSpacing, baseline);
this.renderTextWithLetterSpacing(text, styles.letterSpacing, styles.fontSize.number);
const textShadows: TextShadow = styles.textShadow;

if (textShadows.length && text.text.trim().length) {
Expand All @@ -209,7 +209,11 @@ export class CanvasRenderer extends Renderer {
this.ctx.shadowOffsetY = textShadow.offsetY.number * this.options.scale;
this.ctx.shadowBlur = textShadow.blur.number;

this.renderTextWithLetterSpacing(text, styles.letterSpacing, baseline);
this.renderTextWithLetterSpacing(
text,
styles.letterSpacing,
styles.fontSize.number
);
});

this.ctx.shadowColor = '';
Expand Down

0 comments on commit f2ae901

Please sign in to comment.