Any way to declare default font family and fontSize?

Last post about this is 2020 so I thought maybe this basic function appeared since then:

Is there any way to declare a default font family and defaut font-size for the whole game?

It seems a bit crazy that this is expected to be declared on each text. sizecode matters, and having to repeat font family and font size everywhere feels very inefficient.

No, but you can do

const defaultStyle = { font: '15px fantasy' };

this.add.text(0, 0, 'Hello', { ...defaultStyle });

Yes, you can change the prototype of text creation if you want to keep the API style.

const prototypeText = Phaser.GameObjects.GameObjectFactory.prototype.text
Phaser.GameObjects.GameObjectFactory.prototype.text = function (x, y, text, style = { font: '30px fantasy' }) {
    return, x, y, text, style);

let myText = this.add.text(100, 100, "Hello, Qugurun!");

You can also make your class inheriting from the text and prescribe the necessary default parameters inside the class.

export class Text extends Phaser.GameObjects.Text{
    constructor(scene, x, y, text, style = { font: '30px fantasy' }) {
        super(scene, x, y, text, style);
//other js
import { Text } from "text.js";

... other code

let myText = new Text(this, 100, 200, "Hello, Qugurun!");

you can wrap everything in your text creation function, which will also set default parameters and return ready-made the object.

export function newText (scene, x, y, text,  style = { font: '96px arial' }){
    return scene.add.text(x, y, text, style);
//other js
import { newText } from "text.js";

... other code

let myText = newText(this, 100, 300, "Hello, Qugurun!");