Get a loaded web font (a "fontface" asset): the FontFace the loader added to document.fonts. Text uses it by its name, as a CSS font family.
"fontface"
FontFace
document.fonts
the asset name
the font face, or null if none is loaded under that name
null
await loader.preload([ { name: "kenpixel", type: "fontface", src: "data/font/kenvector_future.woff2" },]);const label = new Text(10, 10, { font: "kenpixel", size: 16, text: "Score" });console.log(loader.getFont("kenpixel").status); // "loaded" Copy
await loader.preload([ { name: "kenpixel", type: "fontface", src: "data/font/kenvector_future.woff2" },]);const label = new Text(10, 10, { font: "kenpixel", size: 16, text: "Score" });console.log(loader.getFont("kenpixel").status); // "loaded"
Get a loaded web font (a
"fontface"asset): theFontFacethe loader added todocument.fonts. Text uses it by its name, as a CSS font family.