fix local fonts

This commit is contained in:
Azgaar 2022-05-10 20:52:30 +03:00
parent e8ae713398
commit 566a811d1f
2 changed files with 5 additions and 8 deletions

View file

@ -1824,7 +1824,7 @@
<div style="display: flex; justify-content: center; padding: 0.4em"> <div style="display: flex; justify-content: center; padding: 0.4em">
<a href="https://war.ukraine.ua/support-ukraine" style="width: 80%" data-tip="Support Ukraine" target="_blank"> <a href="https://war.ukraine.ua/support-ukraine" style="width: 80%" data-tip="Support Ukraine" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" width="auto" height="auto" viewBox="0 0 1000 350"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 350">
<rect width="100%" height="100%" fill="#005bbb"></rect> <rect width="100%" height="100%" fill="#005bbb"></rect>
<rect y="50%" width="100%" height="50%" fill="#ffd500"></rect> <rect y="50%" width="100%" height="50%" fill="#ffd500"></rect>
<text x="50%" text-anchor="middle" font-size="9em" y="35%" fill="#f5f5f5">Support Ukraine</text> <text x="50%" text-anchor="middle" font-size="9em" y="35%" fill="#f5f5f5">Support Ukraine</text>

View file

@ -136,18 +136,15 @@ declareDefaultFonts(); // execute once on load
function declareFont(font) { function declareFont(font) {
const {family, src, ...rest} = font; const {family, src, ...rest} = font;
if (!src) return; addFontOption(family);
if (!src) return;
const fontFace = new FontFace(family, src, {...rest, display: "block"}); const fontFace = new FontFace(family, src, {...rest, display: "block"});
document.fonts.add(fontFace); document.fonts.add(fontFace);
addFontOption(family);
} }
function declareDefaultFonts() { function declareDefaultFonts() {
fonts.forEach(font => { fonts.forEach(font => declareFont(font));
if (font.src) declareFont(font);
else addFontOption(font.family);
});
} }
function getUsedFonts(svg) { function getUsedFonts(svg) {