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) {