Text with Fallback Font
This example demonstrates how to specify a comma-separated list of fallback fonts for a Text object to ensure it renders correctly if the primary font is missing.
800 × 600
class Example extends Phaser.Scene
{
create ()
{
this.add.text(100, 100, 'Hello World', { fontFamily: 'Verdana, "Times New Roman", Tahoma, serif', fontSize: 64, color: '#ffffff' });
}
}
const config = {
scale: { mode: Phaser.Scale.FIT },
type: Phaser.AUTO,
width: 800,
height: 600,
parent: 'game-container',
scene: Example
};
const game = new Phaser.Game(config);