Skip to content

Commit

Permalink
Merge custom and theme font families in getFontFamilyFromSetting.
Browse files Browse the repository at this point in the history
  • Loading branch information
jffng committed Sep 23, 2024
1 parent bffc6ab commit 6d9a472
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions packages/edit-site/src/components/global-styles/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,19 @@ function getFontFamilyFromSetting( fontFamilies, setting ) {
}

export function getFontFamilies( themeJson ) {
const fontFamilies = themeJson?.settings?.typography?.fontFamilies.theme;
// const themeFontFamilies =
// themeJson?.settings?.typography?.fontFamilies?.theme;
// const customFontFamilies =
// themeJson?.settings?.typography?.fontFamilies?.custom;
const themeFontFamilies =
themeJson?.settings?.typography?.fontFamilies?.theme;
const customFontFamilies =
themeJson?.settings?.typography?.fontFamilies?.custom;

// let fontFamilies = [];
// if ( themeFontFamilies && customFontFamilies ) {
// fontFamilies = [ ...themeFontFamilies, ...customFontFamilies ];
// } else if ( themeFontFamilies ) {
// fontFamilies = themeFontFamilies;
// } else if ( customFontFamilies ) {
// fontFamilies = customFontFamilies;
// }
let fontFamilies = [];
if ( themeFontFamilies && customFontFamilies ) {
fontFamilies = [ ...themeFontFamilies, ...customFontFamilies ];
} else if ( themeFontFamilies ) {
fontFamilies = themeFontFamilies;
} else if ( customFontFamilies ) {
fontFamilies = customFontFamilies;
}
const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily;
const bodyFontFamily = getFontFamilyFromSetting(
fontFamilies,
Expand Down

0 comments on commit 6d9a472

Please sign in to comment.