Skip to content

Commit 9c588d9

Browse files
committed
PIXI.BitmapText has been removed as a global array, as it is no longer used.
1 parent 9314c5a commit 9c588d9

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ For the full list of p2 additions please read [their change log](https://github.
393393
* Canvas.setSmoothingEnabled only applies the value of the property exists, which avoids the Chrome webkit prefix deprecation warnings.
394394
* PIXI._CompileShader can now take an array or a string for the fragment src.
395395
* AnimationParser.spriteSheet can now accept either a string-based key or an HTML Image object as the key argument.
396-
* LoaderParser.bitmapFont, xmlBitmapFont and jsonBitmapFont all now return the font data rather than write it to the now deprecated PIXI global font cache.
396+
* LoaderParser.bitmapFont, xmlBitmapFont and jsonBitmapFont all now return the font data rather than write it to the now deprecated PIXI.BitmapText.fonts global array.
397+
* PIXI.BitmapText has been removed as a global array, as it is no longer used.
397398

398399
### Bug Fixes
399400

src/PixiDefaults.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,3 @@ if (PIXI.Graphics.POLY === undefined)
4242
}
4343

4444
PIXI.TextureSilentFail = true;
45-
46-
PIXI.BitmapText = { fonts: {} };

src/gameobjects/BitmapText.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ Phaser.BitmapText = function (game, x, y, font, text, size, align) {
112112
*/
113113
this._text = text;
114114

115+
/**
116+
* @property {string} _data - Internal cache var.
117+
* @private
118+
*/
119+
this._data = game.cache.getBitmapFont(font);
120+
115121
/**
116122
* @property {string} _font - Internal cache var.
117123
* @private
@@ -225,7 +231,7 @@ Phaser.BitmapText.prototype.setText = function (text) {
225231
*
226232
* @method Phaser.BitmapText.prototype.scanLine
227233
* @private
228-
* @param {object} data - A reference to the font object in the PIXI.BitmapText.fonts array.
234+
* @param {object} data - A reference to the font object in the Phaser.Cache.
229235
* @param {float} scale - The scale of the font in relation to the texture.
230236
* @param {string} text - The text to parse.
231237
* @return {object} An object containing the parsed characters, total pixel width and x offsets.
@@ -301,7 +307,7 @@ Phaser.BitmapText.prototype.scanLine = function (data, scale, text) {
301307
*/
302308
Phaser.BitmapText.prototype.updateText = function () {
303309

304-
var data = PIXI.BitmapText.fonts[this._font];
310+
var data = this._data.font;
305311

306312
if (!data)
307313
{

0 commit comments

Comments
 (0)