melonJS
    Preparing search index...

    Function getFont

    • 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.

      Parameters

      • elt: string

        the asset name

      Returns FontFace

      the font face, or null if none is loaded under that name

      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"