Phaser API Documentation

  Version: 
setFont(font)

Description:

Set the font.

If a string is given, the font family is set.

If an object is given, the fontFamily, fontSize and fontStyle properties of that object are set.

Important: The font name must be quoted if it contains certain combinations of digits or special characters:

Text.setFont('"Press Start 2P"');

Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all quoted properly, too:

Text.setFont('Georgia, "Goudy Bookletter 1911", Times, serif');

Parameters:

name type description
font string

The font family or font settings to set.

Returns:
Description:

This Text object.

Since: 3.0.0