Removed CC_FONT_LABEL_SUPPORT since it wasn't defined anywhere and now custom TTF fonts work.

This commit is contained in:
Nicolas Gramlich 2012-06-15 14:06:01 -07:00
parent 420d9ef41b
commit f0c1a4001c
2 changed files with 9 additions and 19 deletions

View File

@ -230,17 +230,14 @@ static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAl
dim = _calculateStringSizeWithFontOrZFont(str, font, &constrainSize, false); dim = _calculateStringSizeWithFontOrZFont(str, font, &constrainSize, false);
} }
#if CC_FONT_LABEL_SUPPORT
if (! font) if (! font)
{ {
font = [[FontManager sharedManager] zFontWithName:fntName pointSize:nSize]; font = [[FontManager sharedManager] zFontWithName:fntName pointSize:nSize];
if (font) if (font)
{ {
//dim = [str sizeWithZFont:font]; dim =_calculateStringSizeWithFontOrZFont(str, font, &constrainSize, true);
dim =_caculateStringSizeWithFontOrZFont(str, font, &constrainSize, true);
} }
} }
#endif // CC_FONT_LABEL_SUPPORT
if (! font) if (! font)
{ {
@ -316,17 +313,14 @@ static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAl
: UITextAlignmentLeft; : UITextAlignmentLeft;
// normal fonts // normal fonts
if( [font isKindOfClass:[UIFont class] ] ) if( [font isKindOfClass:[UIFont class] ] )
{ {
[str drawInRect:CGRectMake(0, startH, dim.width, dim.height) withFont:font lineBreakMode:UILineBreakModeWordWrap alignment:align]; [str drawInRect:CGRectMake(0, startH, dim.width, dim.height) withFont:font lineBreakMode:UILineBreakModeWordWrap alignment:align];
} }
else // ZFont class
#if CC_FONT_LABEL_SUPPORT {
else // ZFont class [FontLabelStringDrawingHelper drawInRect:str rect:CGRectMake(0, startH, dim.width, dim.height) withZFont:font lineBreakMode:UILineBreakModeWordWrap alignment:align];
{ }
[FontLabelStringDrawingHelper drawInRect:str rect:CGRectMake(0, startH, dim.width, dim.height) withZFont:font lineBreakMode:UILineBreakModeWordWrap alignment:align];
}
#endif
UIGraphicsPopContext(); UIGraphicsPopContext();

View File

@ -51,10 +51,6 @@ THE SOFTWARE.
NS_CC_BEGIN NS_CC_BEGIN
#if CC_FONT_LABEL_SUPPORT
// FontLabel support
#endif// CC_FONT_LABEL_SUPPORT
//CLASS IMPLEMENTATIONS: //CLASS IMPLEMENTATIONS:
// If the image has alpha, you can create RGBA8 (32-bit) or RGBA4 (16-bit) or RGB5A1 (16-bit) // If the image has alpha, you can create RGBA8 (32-bit) or RGBA4 (16-bit) or RGB5A1 (16-bit)