From ceb37b25c8f011a3ee076b7888c73223c220efa8 Mon Sep 17 00:00:00 2001 From: Boris Dayma Date: Wed, 24 Aug 2022 16:21:08 -0500 Subject: [PATCH] =?UTF-8?q?fix:=E2=80=AFadjust=20height=20(thanks=20@hazth?= =?UTF-8?q?eo)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/render/canvas/canvas-renderer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/render/canvas/canvas-renderer.ts b/src/render/canvas/canvas-renderer.ts index 609d8a7..26f181a 100644 --- a/src/render/canvas/canvas-renderer.ts +++ b/src/render/canvas/canvas-renderer.ts @@ -146,11 +146,11 @@ export class CanvasRenderer extends Renderer { renderTextWithLetterSpacing(text: TextBounds, letterSpacing: number, baseline: number): void { if (letterSpacing === 0) { - this.ctx.fillText(text.text, text.bounds.left, text.bounds.top - text.bounds.height / 2 + baseline); + this.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height - baseline); } else { const letters = segmentGraphemes(text.text); letters.reduce((left, letter) => { - this.ctx.fillText(letter, left, text.bounds.top - text.bounds.height / 2 + baseline); + this.ctx.fillText(letter, left, text.bounds.top + text.bounds.height - baseline); return left + this.ctx.measureText(letter).width; }, text.bounds.left);