From 9e52c30ce86d7f7e61ffdb5ecad2523e179f620e Mon Sep 17 00:00:00 2001 From: David Luzar Date: Wed, 22 Mar 2023 18:33:37 +0100 Subject: [PATCH] fix: use `ideographic` textBaseline to improve layout shift when editing text (#6384) --- src/renderer/renderElement.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/renderer/renderElement.ts b/src/renderer/renderElement.ts index 0861315c..66d2096c 100644 --- a/src/renderer/renderElement.ts +++ b/src/renderer/renderElement.ts @@ -34,6 +34,7 @@ import { AppState, BinaryFiles, Zoom } from "../types"; import { getDefaultAppState } from "../appState"; import { BOUND_TEXT_PADDING, + FONT_FAMILY, MAX_DECIMALS_FOR_SVG_EXPORT, MIME_TYPES, SVG_NS, @@ -286,7 +287,13 @@ const drawElementOnCanvas = ( : element.textAlign === "right" ? element.width : 0; - context.textBaseline = "bottom"; + + // FIXME temporary hack + context.textBaseline = + element.fontFamily === FONT_FAMILY.Virgil || + element.fontFamily === FONT_FAMILY.Cascadia + ? "ideographic" + : "bottom"; const lineHeightPx = getLineHeightInPx( element.fontSize,