Options
All
  • Public
  • Public/Protected
  • All
Menu

FontFaceObserverFontManager loads fonts (using FontFace or fontfaceobserver library) from the game resources (see loadFonts), and allow to access to the font families of the loaded fonts during the game (see getFontFamily).

Hierarchy

  • FontFaceObserverFontManager

Index

Constructors

Methods

  • getFontFamily(resourceName: string): string
  • Return the font family associated to the specified font resource name. The font resource must have been loaded before. If that's not the case, a default font family will be returned ("Arial").

    Parameters

    • resourceName: string

      The name of the resource to get.

    Returns string

    The font family to be used for this font resource, or "Arial" if not loaded.

  • getFontFile(resourceName: string): string
  • Return the font file associated to the specified font resource name. The font resource must have been loaded before. If that's not the case, the resource name will be returned (to keep compatibility with GDevelop 5.0-beta56 and previous).

    Should only be useful for renderers running on a non HTML5/non browser environment.

    Parameters

    • resourceName: string

      The name of the resource to get.

    Returns string

    The file of the font resource.

  • loadFonts(onProgress: any, onComplete: any): any
  • Load the specified resources, so that fonts are loaded and can then be used by using the font family returned by getFontFamily.

    Parameters

    • onProgress: any

      Callback called each time a new file is loaded.

    • onComplete: any

      Callback called when loading is done.

    Returns any

  • setResources(resources: ResourceData[]): void
  • Update the resources data of the game. Useful for hot-reloading, should not be used otherwise.

    Parameters

    • resources: ResourceData[]

      The resources data of the game.

    Returns void

Generated using TypeDoc