figureone
    Preparing search index...

    Class default

    Font manager can be used to query if fonts are available, and watch to see when they load or time out.

    Notifications - The notification manager property notifications will publish the following events:

    • fontsLoaded: published when all fonts have been loaded or timed out
    • fontLoaded: published after each font is loaded
    • fontUnavailable: published when loading a font has timed out
    Index

    Methods

    • Check if a font's weights are all available.

      The weights must all belong to the same font family and style. The glyphs defined in fontDefinition will be used to check the weights.

      This method compares the width of the glyphs for all given weights. If all widths are different, then this method returns true.

      This means only weights that should exist should be input. For example if a font only supports 'normal' and 'bold', but weights 'lighter' and 'bold' are input, then this will return true as 'lighter' will likely fallback to 'normal'.

      Parameters

      Returns boolean

    • Return arrays of styles that produce the same output.

      This will usually return [['normal'], ['italic', 'oblique']] meaning that italic and oblique styles are the same, but different to normal. Even if only the normal font is available, often the browser will auto italicize the normal font to get an italic font.

      In contrast, this will show [['normal', 'italic', 'oblique']] (meaning all three are the same) if only the italic version of a font is available. This is because the browser simply uses the italic version as the normal version if it is requested.

      Parameters

      Returns string[][]

    • Watch for when a font becomes available, or a timeout is reached.

      Either a font definition, a FigureFont object or a FigureElement can be used to define which font(s) to watch.

      When a FigureElement is used, then all the unique fonts associated with that element will be watched, and any callback defined will be executed when each font is loaded or times out.

      If weights is specified, then the font will not be considered loaded until weights number of different weights are available.

      Parameters

      • fontOrElement: OBJ_Font | FigureFont | FigureElement
      • optionsOrCallback: string | OBJ_LoadFontOptions | (() => void)

        options or callback function to be used when font is loaded or times out.

      Returns any[]