mirror of https://github.com/axmolengine/axmol.git
Merge branch 'new_develop_merge' of https://github.com/carlomorgantinizynga/cocos2d-x into carlomorgantinizynga-new_develop_merge
This commit is contained in:
commit
c61da90441
|
@ -21,12 +21,12 @@ const char *FontAtlasFactory::glyphNEHE = "!\"#$%&'()*+,-./0123456789:;<=>?@ABC
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FontAtlas * FontAtlasFactory::createAtlasFromTTF(const char* tttFilePath, int fontSize, GlyphCollection glyphs, const char *customGlyphs)
|
FontAtlas * FontAtlasFactory::createAtlasFromTTF(const char* fntFilePath, int fontSize, GlyphCollection glyphs, const char *customGlyphs)
|
||||||
{
|
{
|
||||||
FontDefinitionTTF *def = 0;
|
FontDefinitionTTF *def = 0;
|
||||||
if ( (glyphs == GlyphCollection::NEHE) || (glyphs == GlyphCollection::ASCII) )
|
if ( (glyphs == GlyphCollection::NEHE) || (glyphs == GlyphCollection::ASCII) )
|
||||||
{
|
{
|
||||||
def = FontDefinitionTTF::create(tttFilePath, fontSize, getGlyphCollection(glyphs));
|
def = FontDefinitionTTF::create(fntFilePath, fontSize, getGlyphCollection(glyphs));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ FontAtlas * FontAtlasFactory::createAtlasFromTTF(const char* tttFilePath, int fo
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
def = FontDefinitionTTF::create(tttFilePath, fontSize, customGlyphs);
|
def = FontDefinitionTTF::create(fntFilePath, fontSize, customGlyphs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,8 @@ class CC_DLL FontAtlasFactory
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static FontAtlas * createAtlasFromTTF(const char* tttFilePath, int fontSize, GlyphCollection glyphs, const char *customGlyphs = 0);
|
static FontAtlas * createAtlasFromTTF(const char* fntFilePath, int fontSize, GlyphCollection glyphs, const char *customGlyphs = 0);
|
||||||
static FontAtlas * createAtlasFromFNT(const char* tttFilePath);
|
static FontAtlas * createAtlasFromFNT(const char* fntFilePath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,9 @@
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
Label* Label::createWithTTF( const char* label, const char* tttFilePath, int fontSize, GlyphCollection glyphs, int lineSize, const char *customGlyphs )
|
Label* Label::createWithTTF( const char* label, const char* fntFilePath, int fontSize, GlyphCollection glyphs, int lineSize, const char *customGlyphs )
|
||||||
{
|
{
|
||||||
FontAtlas *tempAtlas = FontAtlasCache::getFontAtlasTTF(tttFilePath, fontSize, glyphs, customGlyphs);
|
FontAtlas *tempAtlas = FontAtlasCache::getFontAtlasTTF(fntFilePath, fontSize, glyphs, customGlyphs);
|
||||||
if (!tempAtlas)
|
if (!tempAtlas)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ class CC_DLL Label : public SpriteBatchNode, public LabelProtocol, public RGBAPr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static Label* createWithTTF( const char* label, const char* tttFilePath, int fontSize, GlyphCollection glyphs = GlyphCollection::NEHE, int lineSize = 0, const char *customGlyphs = 0 );
|
static Label* createWithTTF( const char* label, const char* fntFilePath, int fontSize, GlyphCollection glyphs = GlyphCollection::NEHE, int lineSize = 0, const char *customGlyphs = 0 );
|
||||||
static Label* createWithBMFont( const char* label, const char* bmfontFilePath, int lineSize = 0 );
|
static Label* createWithBMFont( const char* label, const char* bmfontFilePath, int lineSize = 0 );
|
||||||
|
|
||||||
virtual ~Label();
|
virtual ~Label();
|
||||||
|
|
|
@ -38,8 +38,8 @@ bool LabelTextFormatter::multilineText(LabelTextFormatProtocol *theLabel)
|
||||||
if (theLabel->getMaxLineWidth())
|
if (theLabel->getMaxLineWidth())
|
||||||
{
|
{
|
||||||
// Step 1: Make multiline
|
// Step 1: Make multiline
|
||||||
vector<unsigned short> str_whole = cc_utf16_vec_from_utf16_str(theLabel->getUTF8String());
|
vector<unsigned short> strWhole = cc_utf16_vec_from_utf16_str(theLabel->getUTF8String());
|
||||||
unsigned int stringLength = str_whole.size();
|
unsigned int stringLength = strWhole.size();
|
||||||
|
|
||||||
vector<unsigned short> multiline_string;
|
vector<unsigned short> multiline_string;
|
||||||
multiline_string.reserve( stringLength );
|
multiline_string.reserve( stringLength );
|
||||||
|
@ -74,7 +74,7 @@ bool LabelTextFormatter::multilineText(LabelTextFormatProtocol *theLabel)
|
||||||
if (i >= stringLength)
|
if (i >= stringLength)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
unsigned short character = str_whole[i];
|
unsigned short character = strWhole[i];
|
||||||
|
|
||||||
if (!start_word)
|
if (!start_word)
|
||||||
{
|
{
|
||||||
|
@ -106,7 +106,7 @@ bool LabelTextFormatter::multilineText(LabelTextFormatProtocol *theLabel)
|
||||||
if (i >= stringLength)
|
if (i >= stringLength)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
character = str_whole[i];
|
character = strWhole[i];
|
||||||
|
|
||||||
if (!startOfWord)
|
if (!startOfWord)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue