From 2b250e282ef029f9067e40af65c49fa2b5a4081b Mon Sep 17 00:00:00 2001 From: Diego Muracciole Date: Sun, 22 Sep 2024 16:46:48 +0200 Subject: [PATCH] fix: svg text rendering (#2867) --- packages/layout/src/svg/layoutText.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/layout/src/svg/layoutText.js b/packages/layout/src/svg/layoutText.js index e29347561..f93d75b57 100644 --- a/packages/layout/src/svg/layoutText.js +++ b/packages/layout/src/svg/layoutText.js @@ -45,10 +45,16 @@ const getFragments = (fontStore, instance) => { const _textDecoration = instance.props.textDecoration; - const obj = fontStore - ? fontStore.getFont({ fontFamily, fontWeight, fontStyle }) - : null; - const font = obj ? obj.data : fontFamily; + const fontFamilies = + typeof fontFamily === 'string' ? [fontFamily] : [...(fontFamily || [])]; + + const font = fontFamilies.map((fontFamilyName) => { + if (typeof fontFamilyName !== 'string') return fontFamilyName; + + const opts = { fontFamily: fontFamilyName, fontWeight, fontStyle }; + const obj = fontStore ? fontStore.getFont(opts) : null; + return obj ? obj.data : fontFamilyName; + }); const attributes = { font,