Skip to content

Commit 6a868cb

Browse files
committed
BitmapText.cleanText is a new method that will scan the given text and either remove or replace all characters that are not present in the font data. It is called automatically by BitmapText.updateText.
1 parent 36d9c8d commit 6a868cb

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ If you are an exceptional JavaScript developer and would like to join the Phaser
270270
### New Features
271271

272272
* You can use the new const `Phaser.PENDING_ATLAS` as the texture key for any sprite. Doing this then sets the key to be the `frame` argument (the frame is set to zero). This allows you to create sprites using `load.image` during development, and then change them to use a Texture Atlas later in development by simply searching your code for 'PENDING_ATLAS' and swapping it to be the key of the atlas data.
273+
* BitmapText.cleanText is a new method that will scan the given text and either remove or replace all characters that are not present in the font data. It is called automatically by `BitmapText.updateText`.
273274

274275
### Updates
275276

@@ -282,6 +283,7 @@ If you are an exceptional JavaScript developer and would like to join the Phaser
282283
* TilemapParser accidentally redeclared `i` when parsing the ImageCollections which would cause an infinite loop (thanks DanHett)
283284
* BitmapData.update causes a snowballing memory leak under WebGL due to a Context.getImageData call. BitmapData.clear used to call update automatically but no longer does. This resolves the issue of the Debug class causing excessive memory build-up in Chrome. Firefox and IE were unaffected (thanks @kingjerod #2208)
284285
* Pausing a Sound that used a Marker for playback would fire the `onMarkerComplete` signal by mistake as well as stop the fadeTween. This Signal is now only dispatched if Sound.stop is called and the Sound isn't paused (thanks Corin)
286+
* BitmapText.text would throw an undefined Texture error if you used a character in your text string that didn't exist in the font data.
285287

286288
### Pixi Updates
287289

src/gameobjects/BitmapText.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ Phaser.BitmapText.prototype.scanLine = function (data, scale, text) {
306306
* Given a text string this will scan each character in the string to ensure it exists
307307
* in the BitmapText font data. If it doesn't the character is removed, or replaced with the `replace` argument.
308308
*
309-
* If no font data has been loaded at all this returns an empty string.
309+
* If no font data has been loaded at all this returns an empty string, as nothing can be rendered.
310310
*
311311
* @method Phaser.BitmapText.prototype.cleanText
312312
* @param {string} text - The text to parse.

0 commit comments

Comments
 (0)