From 133e1d9846b9de628aacdc38c97002a2dd4ada3b Mon Sep 17 00:00:00 2001 From: Cocos Ass Date: Sun, 8 Apr 2018 18:38:30 +0800 Subject: [PATCH] fixed WeChat playform can't identify the ttf font format problem fixed ParticleSystem part memory leak problem fixed the wechat can't identify ttf format problem s fixed WeChat playform can't identify the ttf font format problem fixed WeChat playform can't identify the ttf font format problem s --- cocos2d/core/label/CCSGLabel.js | 16 +++++++++++++--- cocos2d/particle/CCSGParticleSystem.js | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cocos2d/core/label/CCSGLabel.js b/cocos2d/core/label/CCSGLabel.js index 7c5b32ec43..1b30b0e43d 100644 --- a/cocos2d/core/label/CCSGLabel.js +++ b/cocos2d/core/label/CCSGLabel.js @@ -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; }, diff --git a/cocos2d/particle/CCSGParticleSystem.js b/cocos2d/particle/CCSGParticleSystem.js index 46cb048a2a..69687b1a15 100644 --- a/cocos2d/particle/CCSGParticleSystem.js +++ b/cocos2d/particle/CCSGParticleSystem.js @@ -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.
* It's very expensive to change color on Canvas mode, so if set it to true, particle system will ignore the changing color operation.