fix: use ideographic textBaseline to improve layout shift when editing text (#6384)

This commit is contained in:
David Luzar 2023-03-22 18:33:37 +01:00 committed by GitHub
parent 83383977f5
commit 9e52c30ce8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,