Merge pull request #8022 from Dhilan007/v3-labelfix

Label:It may display incorrectly with outline feature enabled.
This commit is contained in:
minggo 2014-09-12 17:54:02 +08:00
commit 0f42d9bbd8
1 changed files with 4 additions and 2 deletions

View File

@ -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) );