From 8a8fa743ebc7bdba2672b989a54fd9b583b8e3ae Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Thu, 27 Mar 2014 14:28:32 +0800 Subject: [PATCH] closed #4565:fixed logical error in Label::setFontAtlas. --- cocos/2d/CCLabel.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 66c58b9eb2..da596b71e2 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -392,7 +392,16 @@ void Label::setFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled /* = false * } _fontAtlas = atlas; - SpriteBatchNode::initWithTexture(_fontAtlas->getTexture(0), 30); + + if (_textureAtlas) + { + _textureAtlas->setTexture(_fontAtlas->getTexture(0)); + } + else + { + SpriteBatchNode::initWithTexture(_fontAtlas->getTexture(0), 30); + } + if (_reusedLetter == nullptr) { _reusedLetter = Sprite::createWithTexture(_fontAtlas->getTexture(0));