You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a BitmapText with setMaxWidth if the max width is less than one of the word's width it creates additional empty lines changing the object's height. This does not happen with text game object.
Example Test Code
classMainSceneextendsPhaser.Scene{constructor(){super({key: "MainScene"});}preload(){this.load.bitmapFont('gothic','https://labs.phaser.io/assets/fonts/bitmap/gothic.png','https://labs.phaser.io/assets/fonts/bitmap/gothic.xml');}create(){// Textconsttext=this.add.text(100,100,'Hello Phaser',{fontFamily: 'Arial Black',fontSize: 32});text.style.setWordWrapWidth(30);// Rectangle matches with game object sizethis.add.rectangle(text.x,text.y,text.width,text.height,0xff00ff,0.3).setOrigin(0);// Bitmap Text constbitmapText=this.add.bitmapText(100,400,'gothic','Hello Phaser',32);bitmapText.setMaxWidth(30);// Rectangle shows the extra empty linethis.add.rectangle(bitmapText.x,bitmapText.y,bitmapText.width,bitmapText.height,0xff00ff,0.3).setOrigin(0);}}constgame=newPhaser.Game({type: Phaser.AUTO,width: 800,height: 800,backgroundColor: '#111111',scale: {mode: Phaser.Scale.FIT,autoCenter: Phaser.Scale.CENTER_BOTH},scene: [MainScene]})
Test screenshot
The BitmapText (bottom) has 3 lines, should have only 2 like the text on the top.
Expected behaviour
Bitmap text should not add additional empty lines even if its text cant fit with the given max width.
The text was updated successfully, but these errors were encountered:
Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.
Version
Description
When using a BitmapText with setMaxWidth if the max width is less than one of the word's width it creates additional empty lines changing the object's height. This does not happen with text game object.
Example Test Code
Test screenshot
The BitmapText (bottom) has 3 lines, should have only 2 like the text on the top.
Expected behaviour
Bitmap text should not add additional empty lines even if its text cant fit with the given max width.
The text was updated successfully, but these errors were encountered: