mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
Merge pull request #1562 from zilongshanren/fix-bmfont-error-v1-4
fix bmfont error
This commit is contained in:
@@ -390,7 +390,11 @@ var Label = cc.Class({
|
||||
|
||||
if (this.font instanceof cc.BitmapFont) {
|
||||
if (this.font.spriteFrame) {
|
||||
this._sgNode.setFontFileOrFamily(this.font.fntDataStr, this.font.spriteFrame);
|
||||
if (!CC_JSB) {
|
||||
this._sgNode.setFontFileOrFamily(this.font.fntDataStr, this.font.spriteFrame, this.font);
|
||||
} else {
|
||||
this._sgNode.setFontFileOrFamily(this.font.fntDataStr, this.font.spriteFrame);
|
||||
}
|
||||
} else {
|
||||
cc.warnID(4011, this.font.name);
|
||||
this._sgNode.setFontFileOrFamily('');
|
||||
|
||||
@@ -242,13 +242,13 @@ _ccsg.Label = _ccsg.Node.extend({
|
||||
}
|
||||
|
||||
this._string = string;
|
||||
this._fontAsset = fontAsset;
|
||||
|
||||
_ccsg.Node.prototype.ctor.call(this);
|
||||
this.setAnchorPoint(cc.p(0.5, 0.5));
|
||||
_ccsg.Node.prototype.setContentSize.call(this, cc.size(128, 128));
|
||||
this._blendFunc = cc.BlendFunc._alphaNonPremultiplied();
|
||||
|
||||
this.setFontFileOrFamily(fontHandle, spriteFrame);
|
||||
this.setFontFileOrFamily(fontHandle, spriteFrame, fontAsset);
|
||||
this.setString(this._string);
|
||||
},
|
||||
|
||||
@@ -529,8 +529,9 @@ _ccsg.Label = _ccsg.Node.extend({
|
||||
}
|
||||
},
|
||||
|
||||
setFontFileOrFamily: function(fontHandle, spriteFrame) {
|
||||
setFontFileOrFamily: function(fontHandle, spriteFrame, fontAsset) {
|
||||
fontHandle = fontHandle || "Arial";
|
||||
this._fontAsset = fontAsset;
|
||||
var extName = cc.path.extname(fontHandle);
|
||||
|
||||
this._resetBMFont();
|
||||
|
||||
Reference in New Issue
Block a user