-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Labels
Description
Version
- Phaser Version: 3.70.0
Description
Setting font on a BitmapText without changing the texture doesnt check the new font-size and ignores it.
Also ignores the align argument.
Expected behaviour
setFont('same-texture', 48);
should work the same as:
setFont('same-texture').setFontSize(48); // This works fine
Example Test Code
class Example extends Phaser.Scene {
preload() {
this.load.bitmapFont('desyrel', 'assets/fonts/bitmap/desyrel.png', 'assets/fonts/bitmap/desyrel.xml');
this.load.bitmapFont('desyrel-pink', 'assets/fonts/bitmap/desyrel-pink.png', 'assets/fonts/bitmap/desyrel-pink.xml');
this.load.bitmapFont('shortStack', 'assets/fonts/bitmap/shortStack.png', 'assets/fonts/bitmap/shortStack.xml');
}
create() {
const b2 = this.add.bitmapText(400, 400, 'desyrel', 'Phaser test', 40);
b2.setFont('desyrel', 12);
console.warn(b2.fontSize); // It should be 12 but it is 40
// If the font changes it works fine
// b2.setFont('shortStack', 12);
// console.warn(b2.fontSize);
}
}
const config = {
type: Phaser.WEBGL,
parent: 'phaser-example',
scene: Example
};
const game = new Phaser.Game(config);