From a23b128ae29e2ee7e9d5f346e5c8f1b37e81083d Mon Sep 17 00:00:00 2001 From: Aleksandr Bazhin Date: Mon, 6 Nov 2023 00:13:52 +0700 Subject: [PATCH] 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. --- examples/common/font/font_manager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/common/font/font_manager.cpp b/examples/common/font/font_manager.cpp index 5416fc557..2af76f259 100644 --- a/examples/common/font/font_manager.cpp +++ b/examples/common/font/font_manager.cpp @@ -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 {