soiz1's picture
Upload folder using huggingface_hub
4d70170 verified
raw
history blame contribute delete
819 Bytes
import { ref } from 'vue'
import * as PIXI from 'pixi.js-legacy'
let installedFonts = false
export async function installFonts() {
if (installedFonts) {
return
}
try {
await document.fonts.load('10px "Roboto Mono"')
}
catch (e) {
console.error(e)
}
PIXI.BitmapFont.from('roboto-black', {
fontFamily: 'Roboto Mono',
fontSize: 9,
fill: '#000000',
}, {
resolution: window.devicePixelRatio,
})
PIXI.BitmapFont.from('roboto-white', {
fontFamily: 'Roboto Mono',
fontSize: 9,
fill: '#ffffff',
}, {
resolution: window.devicePixelRatio,
})
installedFonts = true
}
export function useFonts() {
const loaded = ref(installedFonts)
async function _load() {
await installFonts()
loaded.value = true
}
_load()
return {
loaded,
}
}