mirror of https://github.com/axmolengine/axmol.git
three related bug fixes in FontAtlas::prepareLetterDefinitions
This commit is contained in:
parent
9af2f4e73a
commit
1420ea2cbc
|
@ -341,17 +341,12 @@ bool FontAtlas::prepareLetterDefinitions(const std::u16string& utf16Text)
|
||||||
tempDef.offsetX = tempRect.origin.x + adjustForDistanceMap + adjustForExtend;
|
tempDef.offsetX = tempRect.origin.x + adjustForDistanceMap + adjustForExtend;
|
||||||
tempDef.offsetY = _fontAscender + tempRect.origin.y - adjustForDistanceMap - adjustForExtend;
|
tempDef.offsetY = _fontAscender + tempRect.origin.y - adjustForDistanceMap - adjustForExtend;
|
||||||
|
|
||||||
glyphHeight = static_cast<int>(bitmapHeight) + _letterPadding + _letterEdgeExtend;
|
|
||||||
if (glyphHeight > _currLineHeight)
|
|
||||||
{
|
|
||||||
_currLineHeight = glyphHeight;
|
|
||||||
}
|
|
||||||
if (_currentPageOrigX + tempDef.width > CacheTextureWidth)
|
if (_currentPageOrigX + tempDef.width > CacheTextureWidth)
|
||||||
{
|
{
|
||||||
_currentPageOrigY += _currLineHeight;
|
_currentPageOrigY += _currLineHeight;
|
||||||
_currLineHeight = 0;
|
_currLineHeight = 0;
|
||||||
_currentPageOrigX = 0;
|
_currentPageOrigX = 0;
|
||||||
if (_currentPageOrigY + _lineHeight >= CacheTextureHeight)
|
if (_currentPageOrigY + _lineHeight + _letterPadding + _letterEdgeExtend >= CacheTextureHeight)
|
||||||
{
|
{
|
||||||
unsigned char *data = nullptr;
|
unsigned char *data = nullptr;
|
||||||
if (pixelFormat == Texture2D::PixelFormat::AI88)
|
if (pixelFormat == Texture2D::PixelFormat::AI88)
|
||||||
|
@ -385,6 +380,11 @@ bool FontAtlas::prepareLetterDefinitions(const std::u16string& utf16Text)
|
||||||
tex->release();
|
tex->release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
glyphHeight = static_cast<int>(bitmapHeight) + _letterPadding + _letterEdgeExtend;
|
||||||
|
if (glyphHeight > _currLineHeight)
|
||||||
|
{
|
||||||
|
_currLineHeight = glyphHeight;
|
||||||
|
}
|
||||||
_fontFreeType->renderCharAt(_currentPageData, _currentPageOrigX + adjustForExtend, _currentPageOrigY + adjustForExtend, bitmap, bitmapWidth, bitmapHeight);
|
_fontFreeType->renderCharAt(_currentPageData, _currentPageOrigX + adjustForExtend, _currentPageOrigY + adjustForExtend, bitmap, bitmapWidth, bitmapHeight);
|
||||||
|
|
||||||
tempDef.U = _currentPageOrigX;
|
tempDef.U = _currentPageOrigX;
|
||||||
|
@ -425,7 +425,7 @@ bool FontAtlas::prepareLetterDefinitions(const std::u16string& utf16Text)
|
||||||
{
|
{
|
||||||
data = _currentPageData + CacheTextureWidth * (int)startY;
|
data = _currentPageData + CacheTextureWidth * (int)startY;
|
||||||
}
|
}
|
||||||
_atlasTextures[_currentPage]->updateWithData(data, 0, startY, CacheTextureWidth, _currentPageOrigY - startY + _lineHeight);
|
_atlasTextures[_currentPage]->updateWithData(data, 0, startY, CacheTextureWidth, _currentPageOrigY - startY + _currLineHeight);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue