Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into developBug

This commit is contained in:
samuele3hu 2014-01-26 22:31:57 +08:00
commit 1ad43e676e
4 changed files with 8 additions and 5 deletions

View File

@ -26,6 +26,7 @@ cocos2d-x-3.0beta2 ?.? ?
[FIX] CocoStudio: The order of transform calculation in Skin::getNodeToWorldTransform() is incorrect. [FIX] CocoStudio: The order of transform calculation in Skin::getNodeToWorldTransform() is incorrect.
[FIX] Crash if file doesn't exist when using FileUtils::getStringFromFile. [FIX] Crash if file doesn't exist when using FileUtils::getStringFromFile.
[FIX] If setting a shorter string than before while using LabelAtlas, the effect will be wrong. [FIX] If setting a shorter string than before while using LabelAtlas, the effect will be wrong.
[FIX] Label: Memory leak in FontFreeType::createFontAtlas().
[FIX] Label: Crash when using unknown characters. [FIX] Label: Crash when using unknown characters.
[FIX] Label: Missing line breaks and wrong alignment. [FIX] Label: Missing line breaks and wrong alignment.
[FIX] Label: Color and opacity settings aren't applied when invoking Label::alignText. [FIX] Label: Color and opacity settings aren't applied when invoking Label::alignText.

View File

@ -99,7 +99,7 @@ const char * Font::getCurrentGlyphCollection() const
} }
} }
unsigned short int * Font::getUTF16Text(const char *text, int &outNumLetters) const unsigned short* Font::getUTF16Text(const char *text, int &outNumLetters) const
{ {
unsigned short* utf16String = cc_utf8_to_utf16(text); unsigned short* utf16String = cc_utf8_to_utf16(text);
@ -115,7 +115,7 @@ int Font::getUTF16TextLenght(unsigned short int *text) const
return cc_wcslen(text); return cc_wcslen(text);
} }
unsigned short int * Font::trimUTF16Text(unsigned short int *text, int newBegin, int newEnd) const unsigned short * Font::trimUTF16Text(unsigned short int *text, int newBegin, int newEnd) const
{ {
if ( newBegin < 0 || newEnd <= 0 ) if ( newBegin < 0 || newEnd <= 0 )
return 0; return 0;

View File

@ -49,8 +49,8 @@ public:
virtual int getFontMaxHeight() const { return 0; } virtual int getFontMaxHeight() const { return 0; }
virtual int getUTF16TextLenght(unsigned short int *text) const; virtual int getUTF16TextLenght(unsigned short int *text) const;
virtual unsigned short int * getUTF16Text(const char *text, int &outNumLetters) const; virtual unsigned short * getUTF16Text(const char *text, int &outNumLetters) const;
virtual unsigned short int * trimUTF16Text(unsigned short int *text, int newBegin, int newEnd) const; virtual unsigned short * trimUTF16Text(unsigned short int *text, int newBegin, int newEnd) const;
protected: protected:

View File

@ -136,7 +136,9 @@ FontAtlas * FontFreeType::createFontAtlas()
FontAtlas *atlas = new FontAtlas(*this); FontAtlas *atlas = new FontAtlas(*this);
if (_usedGlyphs != GlyphCollection::DYNAMIC) if (_usedGlyphs != GlyphCollection::DYNAMIC)
{ {
atlas->prepareLetterDefinitions(cc_utf8_to_utf16(getCurrentGlyphCollection())); unsigned short* utf16 = cc_utf8_to_utf16(getCurrentGlyphCollection());
atlas->prepareLetterDefinitions(utf16);
CC_SAFE_DELETE_ARRAY(utf16);
} }
this->release(); this->release();
return atlas; return atlas;