From a31f8f6ab7cbee1c43249ccdce10da58b3e60c09 Mon Sep 17 00:00:00 2001 From: Jumperzz <47196328+mrjeanp@users.noreply.github.com> Date: Mon, 22 Jul 2024 13:11:30 -0500 Subject: [PATCH] fix: standard fonts not rendering --- packages/layout/src/text/fontSubstitution.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/layout/src/text/fontSubstitution.js b/packages/layout/src/text/fontSubstitution.js index 40b8bafc8..6edf1b0d7 100644 --- a/packages/layout/src/text/fontSubstitution.js +++ b/packages/layout/src/text/fontSubstitution.js @@ -6,6 +6,8 @@ const fontCache = {}; const IGNORED_CODE_POINTS = [173]; +const standard = ['Courier', 'Courier-Bold', 'Courier-Oblique', 'Courier-BoldOblique', 'Helvetica', 'Helvetica-Bold', 'Helvetica-Oblique', 'Helvetica-BoldOblique', 'Times-Roman', 'Times-Bold', 'Times-Italic', 'Times-BoldItalic']; + const getFontSize = (node) => node.attributes.fontSize || 12; const getOrCreateFont = (name) => { @@ -23,6 +25,9 @@ const pickFontFromFontStack = (codePoint, fontStack, lastFont) => { const fontStackWithFallback = [...fontStack, lastFont, getFallbackFont()]; for (let i = 0; i < fontStackWithFallback.length; i += 1) { const font = fontStackWithFallback[i]; + if (standard.includes(font)) { + return getOrCreateFont(font); + } if ( !IGNORED_CODE_POINTS.includes(codePoint) && font &&