mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-03-25 00:27:24 +01:00
fix: declare global declareFont
This commit is contained in:
parent
e49be0b48f
commit
f7d52997c4
1 changed files with 5 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { byId } from "../utils";
|
||||
|
||||
declare global {
|
||||
var declareFont: (font: FontDefinition) => void;
|
||||
var getUsedFonts: (svg: SVGSVGElement) => FontDefinition[];
|
||||
var loadFontsAsDataURI: (
|
||||
fonts: FontDefinition[],
|
||||
|
|
@ -269,16 +270,16 @@ window.fonts = [
|
|||
},
|
||||
];
|
||||
|
||||
declareDefaultFonts(); // execute once on load
|
||||
|
||||
function declareFont(font: FontDefinition) {
|
||||
window.declareFont = (font: FontDefinition) => {
|
||||
const { family, src, ...rest } = font;
|
||||
addFontOption(family);
|
||||
|
||||
if (!src) return;
|
||||
const fontFace = new FontFace(family, src, { ...rest, display: "block" });
|
||||
document.fonts.add(fontFace);
|
||||
}
|
||||
};
|
||||
|
||||
declareDefaultFonts(); // execute once on load
|
||||
|
||||
function declareDefaultFonts() {
|
||||
fonts.forEach((font) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue