Fix kerning for SDF scaled fonts in font_manager.cpp (#3192)

Kerning is now also scaled with the scaled child font when using SDF fonts. In examples/common/font_manager.cpp kerning was visibly off when scaling SDF font down.
This commit is contained in:
Aleksandr Bazhin 2023-11-06 00:13:52 +07:00 committed by GitHub
parent de9f4b3385
commit a23b128ae2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -522,7 +522,9 @@ float FontManager::getKerning(FontHandle _handle, CodePoint _prevCodePoint, Code
if (isValid(cachedFont.masterFontHandle))
{
CachedFont& baseFont = m_cachedFonts[cachedFont.masterFontHandle.idx];
return baseFont.trueTypeFont->m_scale * stbtt_GetCodepointKernAdvance(&baseFont.trueTypeFont->m_font, _prevCodePoint, _codePoint);
return baseFont.trueTypeFont->m_scale
* stbtt_GetCodepointKernAdvance(&baseFont.trueTypeFont->m_font, _prevCodePoint, _codePoint)
* cachedFont.fontInfo.scale;
}
else
{