From 566a811d1fdebe2b23cf8ceb94b114cf8498602a Mon Sep 17 00:00:00 2001 From: Azgaar Date: Tue, 10 May 2022 20:52:30 +0300 Subject: [PATCH] fix local fonts --- index.html | 4 ++-- modules/fonts.js | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 8b321ad1..28e9deae 100644 --- a/index.html +++ b/index.html @@ -1824,7 +1824,7 @@
- + Support Ukraine @@ -6250,7 +6250,7 @@ - + diff --git a/modules/fonts.js b/modules/fonts.js index 652ee524..1f5b1573 100644 --- a/modules/fonts.js +++ b/modules/fonts.js @@ -136,18 +136,15 @@ declareDefaultFonts(); // execute once on load function declareFont(font) { const {family, src, ...rest} = font; - if (!src) return; + addFontOption(family); + if (!src) return; const fontFace = new FontFace(family, src, {...rest, display: "block"}); document.fonts.add(fontFace); - addFontOption(family); } function declareDefaultFonts() { - fonts.forEach(font => { - if (font.src) declareFont(font); - else addFontOption(font.family); - }); + fonts.forEach(font => declareFont(font)); } function getUsedFonts(svg) {