Merge pull request #5606 from vforsh/master

Fix #5545
This commit is contained in:
Richard Davey 2021-03-24 15:46:41 +00:00 committed by GitHub
commit 9aa08a4a4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 3 deletions

View file

@ -35,7 +35,7 @@ var ParseFromAtlas = function (scene, fontName, textureKey, frameKey, xmlKey, xS
{
var data = ParseXMLBitmapFont(xml, frame, xSpacing, ySpacing, texture);
scene.sys.cache.bitmapFont.add(fontName, { data: data, texture: textureKey, frame: frameKey });
scene.sys.cache.bitmapFont.add(fontName, { data: data, texture: textureKey, frame: frameKey, fromAtlas: true });
return true;
}

View file

@ -34,7 +34,9 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, camera, parentMat
camera.addToRenderList(src);
var textureFrame = src.frame;
var textureFrame = src.fromAtlas
? src.frame
: src.texture.frames['__BASE'];
var displayCallback = src.displayCallback;
var callbackData = src.callbackData;

View file

@ -264,6 +264,15 @@ var BitmapText = new Class({
*/
this.dropShadowAlpha = 0.5;
/**
* Indicates whether the font texture is from an atlas or not.
*
* @name Phaser.GameObjects.BitmapText#fromAtlas
* @type {boolean}
* @since 3.53.2
*/
this.fromAtlas = entry.fromAtlas === true;
this.setTexture(entry.texture, entry.frame);
this.setPosition(x, y);
this.setOrigin(0, 0);
@ -758,6 +767,7 @@ var BitmapText = new Class({
this.fontData = entry.data;
this._fontSize = size;
this._align = align;
this.fromAtlas = entry.fromAtlas === true;
this.setTexture(entry.texture, entry.frame);

View file

@ -34,7 +34,9 @@ var BitmapTextCanvasRenderer = function (renderer, src, camera, parentMatrix)
camera.addToRenderList(src);
var textureFrame = src.texture.frames['__BASE'];
var textureFrame = src.fromAtlas
? src.frame
: src.texture.frames['__BASE'];
var chars = src.fontData.chars;
var lineHeight = src.fontData.lineHeight;