FontFaceObserverFontManager

FontFaceObserverFontManager

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

Constructor

new FontFaceObserverFontManager(resources)

Parameters:
Name Type Description
resources

The resources data of the game.

Source:

Methods

getFontFamily(resourceName)

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:
Name Type Description
resourceName

The name of the resource to get.

Returns:
Type Description

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

Source:

getFontFile(resourceName)

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:
Name Type Description
resourceName

The name of the resource to get.

Returns:
Type Description

The file of the font resource.

Source:

loadFonts(onProgress, onComplete)

Load the specified resources, so that fonts are loaded and can then be used by using the font family returned by getFontFamily.

Parameters:
Name Type Description
onProgress

Callback called each time a new file is loaded.

onComplete

Callback called when loading is done.

Source:

setResources(resources)

Update the resources data of the game. Useful for hot-reloading, should not be used otherwise.

Parameters:
Name Type Description
resources

The resources data of the game.

Source: