mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: add missing font metrics for Assistant (#7752)
This commit is contained in:
parent
a38e82f999
commit
68b1fdb20e
1 changed files with 7 additions and 1 deletions
|
@ -326,7 +326,8 @@ export const getVerticalOffset = (
|
||||||
fontSize: ExcalidrawTextElement["fontSize"],
|
fontSize: ExcalidrawTextElement["fontSize"],
|
||||||
lineHeightPx: number,
|
lineHeightPx: number,
|
||||||
) => {
|
) => {
|
||||||
const { unitsPerEm, ascender, descender } = FONT_METRICS[fontFamily];
|
const { unitsPerEm, ascender, descender } =
|
||||||
|
FONT_METRICS[fontFamily] || FONT_METRICS[FONT_FAMILY.Helvetica];
|
||||||
|
|
||||||
const fontSizeEm = fontSize / unitsPerEm;
|
const fontSizeEm = fontSize / unitsPerEm;
|
||||||
const lineGap = lineHeightPx - fontSizeEm * ascender + fontSizeEm * descender;
|
const lineGap = lineHeightPx - fontSizeEm * ascender + fontSizeEm * descender;
|
||||||
|
@ -953,6 +954,11 @@ const FONT_METRICS = {
|
||||||
ascender: 1977,
|
ascender: 1977,
|
||||||
descender: -480,
|
descender: -480,
|
||||||
},
|
},
|
||||||
|
[FONT_FAMILY.Assistant]: {
|
||||||
|
unitsPerEm: 1000,
|
||||||
|
ascender: 1050,
|
||||||
|
descender: -500,
|
||||||
|
},
|
||||||
} as Record<number, FontMetrics>;
|
} as Record<number, FontMetrics>;
|
||||||
|
|
||||||
export const getDefaultLineHeight = (fontFamily: FontFamilyValues) => {
|
export const getDefaultLineHeight = (fontFamily: FontFamilyValues) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue