Skip to main content

FontSource

An interface describing loadable resources in Excalibur. Built-in loadable resources include [[Texture]], [[Sound]], and a generic [[Resource]].

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

  • Parameters

    • path: string

      Path to the font resource relative from the HTML document hosting the game, or absolute

    • family: string

      The font family name

    • __namedParameters: FontSourceOptions = {}

    Returns FontSource

Properties

data

data: FontFace

Data associated with a loadable

publicreadonlyfamily

family: string

The font family name

publicreadonlypath

path: string

Path to the font resource relative from the HTML document hosting the game, or absolute

Methods

isLoaded

  • isLoaded(): boolean
  • Returns true if the loadable is loaded


    Returns boolean

load

  • load(): Promise<FontFace>
  • Begins loading the resource and returns a promise to be resolved on completion


    Returns Promise<FontFace>

toFont

  • Build a font from this FontSource.


    Parameters

    • optionaloptions: FontOptions

      {FontOptions} Override the font options

    Returns Font