From f05f6b5ca5b47f3068520e676d7eb900a3d81f0b Mon Sep 17 00:00:00 2001 From: Boris Dayma Date: Thu, 25 Aug 2022 20:33:36 -0500 Subject: [PATCH] Revert "fix: correct text alignment" This reverts commit 4dbd0da0ec1ddbc9428aec72b8d9d8a00398f448. --- 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 26f181a..609d8a7 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 - baseline); + this.ctx.fillText(text.text, text.bounds.left, text.bounds.top - text.bounds.height / 2 + baseline); } else { const letters = segmentGraphemes(text.text); letters.reduce((left, letter) => { - this.ctx.fillText(letter, left, text.bounds.top + text.bounds.height - baseline); + this.ctx.fillText(letter, left, text.bounds.top - text.bounds.height / 2 + baseline); return left + this.ctx.measureText(letter).width; }, text.bounds.left);