Class Font

const { LazyCanvas, Font } = require('@hitomihiumi/lazy-canvas')

let fontOne = new Font()
.setFamily("JoeKubert")
.setWeight("regular")
.setPath("./fonts/v_CCJoeKubert-Doubled_v1.3.ttf")

let fontTwo = new Font()
.setFamily("Koulen")
.setWeight("regular")
.setPath("./fonts/Koulen-Regular.ttf")

const lazy = new LazyCanvas()
.loadFonts(fontOne, fontTwo)
//...

Constructors

Properties

Methods

Constructors

Properties

Methods

  • Set the path where this font is located. THE BASE FOLDER IN THE PATH IS THE ROOT FOLDER OF THE PROJECT.

    Parameters

    • path: string

      The path to the font file

    Returns Font

    './some/path/to/font.ttf'
    
  • Parameters

    • weight:
          | "normal"
          | "bold"
          | "italic"
          | "bold italic"
          | "regular"
          | "semi-bold"
          | "extra-bold"
          | "light"
          | "extra-light"

      The font weight

    Returns Font

  • Returns {
        family: string;
        path: string;
        structureType: string;
        weight:
            | "normal"
            | "bold"
            | "italic"
            | "bold italic"
            | "regular"
            | "semi-bold"
            | "extra-bold"
            | "light"
            | "extra-light";
        toJSON(): LazyCanvasFont;
    }

    • family: string
    • path: string
    • structureType: string
    • weight:
          | "normal"
          | "bold"
          | "italic"
          | "bold italic"
          | "regular"
          | "semi-bold"
          | "extra-bold"
          | "light"
          | "extra-light"
    • toJSON:function