diff --git a/cocos2dx/label_nodes/CCBitmapFontAtlas.cpp b/cocos2dx/label_nodes/CCBitmapFontAtlas.cpp index 43b827ca94..7e8cd236a1 100644 --- a/cocos2dx/label_nodes/CCBitmapFontAtlas.cpp +++ b/cocos2dx/label_nodes/CCBitmapFontAtlas.cpp @@ -396,11 +396,12 @@ namespace cocos2d{ CGSize tmpSize = CGSizeZero; UINT32 len = m_sString.length(); - for(UINT32 i=0; ikerningAmountForFirst(prev, (INT16)c); + kerningAmount = this->kerningAmountForFirst(prev, c); ccBitmapFontDef fontDef = m_pConfiguration->m_pBitmapFontArray[c]; @@ -408,8 +409,9 @@ namespace cocos2d{ CCSprite *fontChar; - fontChar = (CCSprite*)(this->getChildByTag(i)); - if( ! fontChar ) { + fontChar = dynamic_cast(this->getChildByTag(i)); + if( ! fontChar ) + { fontChar = new CCSprite(); fontChar->initWithSpriteSheet(this, rect); this->addChild(fontChar, 0, i);