Merge pull request #2495 from CocosAss/v1.9

fixed the wechat platform can't idenitfy the ttf problem
This commit is contained in:
Jare Guo
2018-04-09 10:39:23 +08:00
committed by GitHub
2 changed files with 14 additions and 3 deletions
+13 -3
View File
@@ -490,13 +490,23 @@ _ccsg.Label = _ccsg.Node.extend({
_loadTTFFont: function(fontHandle) {
var self = this;
var fontFamilyName = cc.CustomFontLoader._getFontFamily(fontHandle);
var callback = function () {
self._notifyLabelSkinDirty();
self.emit('load');
};
cc.CustomFontLoader.loadTTF(fontHandle, callback);
var fontFamilyName = "";
if (CC_WECHATGAME) {
fontFamilyName = wx.loadFont(fontHandle);
//avoid the error in wechat devtool platform
if (!fontFamilyName) {
fontFamilyName = cc.CustomFontLoader._getFontFamily(fontHandle);
}
callback();
} else {
fontFamilyName = cc.CustomFontLoader._getFontFamily(fontHandle);
cc.CustomFontLoader.loadTTF(fontHandle, callback);
}
return fontFamilyName;
},
+1
View File
@@ -349,6 +349,7 @@ _ccsg.ParticleSystem = _ccsg.Node.extend({
this.scheduleUpdateWithPriority(1);
_ccsg.Node.prototype.onEnter.call(this);
},
/**
* This is a hack function for performance, it's only available on Canvas mode. <br/>
* It's very expensive to change color on Canvas mode, so if set it to true, particle system will ignore the changing color operation.