From ff6abd1d8c4add74bca8030a67c9e329445d4cf2 Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 7 May 2012 10:15:57 +0800 Subject: [PATCH] fixed #1230: fix a bug in calculating string width --- cocos2dx/platform/ios/CCImage.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cocos2dx/platform/ios/CCImage.mm b/cocos2dx/platform/ios/CCImage.mm index fe02567471..e9b53d7305 100644 --- a/cocos2dx/platform/ios/CCImage.mm +++ b/cocos2dx/platform/ios/CCImage.mm @@ -170,7 +170,7 @@ static bool _isValidFontName(const char *fontName) return ret; } -static CGSize _caculateStringSizeWithFontOrZFont(NSString *str, id font, CGSize *constrainSize, bool isZfont) +static CGSize _calculateStringSizeWithFontOrZFont(NSString *str, id font, CGSize *constrainSize, bool isZfont) { NSArray *listItems = [str componentsSeparatedByString: @"\n"]; CGSize dim = CGSizeZero; @@ -186,7 +186,7 @@ static CGSize _caculateStringSizeWithFontOrZFont(NSString *str, id font, CGSize CGSize tmp; if (isZfont) { - tmp = [FontLabelStringDrawingHelper sizeWithZFont:str zfont:font constrainedToSize:textRect]; + tmp = [FontLabelStringDrawingHelper sizeWithZFont:s zfont:font constrainedToSize:textRect]; } else { @@ -222,7 +222,7 @@ static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAl font = [UIFont fontWithName:fntName size:nSize]; if (font) { - dim = _caculateStringSizeWithFontOrZFont(str, font, &constrainSize, false); + dim = _calculateStringSizeWithFontOrZFont(str, font, &constrainSize, false); } #if CC_FONT_LABEL_SUPPORT @@ -249,7 +249,7 @@ static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAl if (font) { - dim = _caculateStringSizeWithFontOrZFont(str, font, &constrainSize, false); + dim = _calculateStringSizeWithFontOrZFont(str, font, &constrainSize, false); } }