From bae36b7a98dc27d68ce1aa690d9ef30516671692 Mon Sep 17 00:00:00 2001 From: Wenhai Lin Date: Tue, 2 Feb 2016 11:16:36 +0800 Subject: [PATCH] Label:Fixed characters are displayed incorrectly with some specific font. --- 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 68e36b933d..2511e1d70e 100644 --- a/cocos/2d/CCFontAtlas.cpp +++ b/cocos/2d/CCFontAtlas.cpp @@ -321,6 +321,7 @@ bool FontAtlas::prepareLetterDefinitions(const std::u16string& utf16Text) int adjustForExtend = _letterEdgeExtend / 2; long bitmapWidth; long bitmapHeight; + int glyphHeight; Rect tempRect; FontLetterDefinition tempDef; @@ -340,9 +341,10 @@ bool FontAtlas::prepareLetterDefinitions(const std::u16string& utf16Text) tempDef.offsetX = tempRect.origin.x + adjustForDistanceMap + adjustForExtend; tempDef.offsetY = _fontAscender + tempRect.origin.y - adjustForDistanceMap - adjustForExtend; - if (bitmapHeight > _currLineHeight) + glyphHeight = static_cast(bitmapHeight) + _letterPadding + _letterEdgeExtend; + if (glyphHeight > _currLineHeight) { - _currLineHeight = static_cast(bitmapHeight) + _letterPadding + _letterEdgeExtend + 1; + _currLineHeight = glyphHeight; } if (_currentPageOrigX + tempDef.width > CacheTextureWidth) {