From 23f1b740bf211387869d9774382f67be48c817ea Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Fri, 12 Sep 2014 16:03:01 +0800 Subject: [PATCH] Label:It may display incorrectly with outline feature enabled. --- cocos/2d/CCFontAtlas.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cocos/2d/CCFontAtlas.cpp b/cocos/2d/CCFontAtlas.cpp index 3e593369db..be92cbc4b6 100644 --- a/cocos/2d/CCFontAtlas.cpp +++ b/cocos/2d/CCFontAtlas.cpp @@ -64,15 +64,17 @@ FontAtlas::FontAtlas(Font &theFont) _letterPadding += 2 * FontFreeType::DistanceMapSpread; } _currentPageDataSize = CacheTextureWidth * CacheTextureHeight; - if(fontTTf->getOutlineSize() > 0) + auto outlineSize = fontTTf->getOutlineSize(); + if(outlineSize > 0) { + _commonLineHeight += 2 * outlineSize * CC_CONTENT_SCALE_FACTOR(); _currentPageDataSize *= 2; } _currentPageData = new unsigned char[_currentPageDataSize]; memset(_currentPageData, 0, _currentPageDataSize); - auto pixelFormat = fontTTf->getOutlineSize() > 0 ? Texture2D::PixelFormat::AI88 : Texture2D::PixelFormat::A8; + auto pixelFormat = outlineSize > 0 ? Texture2D::PixelFormat::AI88 : Texture2D::PixelFormat::A8; texture->initWithData(_currentPageData, _currentPageDataSize, pixelFormat, CacheTextureWidth, CacheTextureHeight, Size(CacheTextureWidth,CacheTextureHeight) );