Skip to content

Commit

Permalink
Font Library: Prevent error when installing a system font twice (#58141)
Browse files Browse the repository at this point in the history
  • Loading branch information
creativecoder committed Jan 23, 2024
1 parent eb30f83 commit dde2059
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,15 @@ function FontLibraryProvider( { children } ) {

// Use the sucessfully installed font faces
// As well as any font faces that were already installed (those will be activated)
fontFamilyToInstall.fontFace = [
...sucessfullyInstalledFontFaces,
...alreadyInstalledFontFaces,
];
if (
sucessfullyInstalledFontFaces?.length > 0 ||
alreadyInstalledFontFaces?.length > 0
) {
fontFamilyToInstall.fontFace = [
...sucessfullyInstalledFontFaces,
...alreadyInstalledFontFaces,
];
}

// Activate the font family (add the font family to the global styles).
activateCustomFontFamilies( [ fontFamilyToInstall ] );
Expand Down

0 comments on commit dde2059

Please sign in to comment.