UNPKG

pixi.js

Version:

<p align="center"> <a href="https://pixijs.com" target="_blank" rel="noopener noreferrer"> <img height="150" src="https://files.pixijs.download/branding/pixijs-logo-transparent-dark.svg?v=1" alt="PixiJS logo"> </a> </p> <br/> <p align="center">

31 lines (28 loc) 1.09 kB
import { Cache } from '../../../assets/cache/Cache.mjs'; import { loadFontCSS } from './loadFontCSS.mjs'; "use strict"; const FontStylePromiseCache = /* @__PURE__ */ new Map(); async function getFontCss(fontFamilies, style, defaultOptions) { const fontPromises = fontFamilies.filter((fontFamily) => Cache.has(`${fontFamily}-and-url`)).map((fontFamily, i) => { if (!FontStylePromiseCache.has(fontFamily)) { const { url } = Cache.get(`${fontFamily}-and-url`); if (i === 0) { FontStylePromiseCache.set(fontFamily, loadFontCSS({ fontWeight: style.fontWeight, fontStyle: style.fontStyle, fontFamily }, url)); } else { FontStylePromiseCache.set(fontFamily, loadFontCSS({ fontWeight: defaultOptions.fontWeight, fontStyle: defaultOptions.fontStyle, fontFamily }, url)); } } return FontStylePromiseCache.get(fontFamily); }); return (await Promise.all(fontPromises)).join("\n"); } export { FontStylePromiseCache, getFontCss }; //# sourceMappingURL=getFontCss.mjs.map