Skip to content

Commit

Permalink
Fix kerning for SDF scaled fonts in font_manager.cpp (#3192)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aleksandrbazhin authored Nov 5, 2023
1 parent de9f4b3 commit a23b128
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/common/font/font_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit a23b128

Please sign in to comment.