Skip to content

Commit

Permalink
fix: svg text rendering (#2867)
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomura authored Sep 22, 2024
1 parent ef4000f commit 2b250e2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/layout/src/svg/layoutText.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2b250e2

Please sign in to comment.