From f76f0607c77b0617317dc8b4ec84530b184a21a7 Mon Sep 17 00:00:00 2001 From: Radek Dutkiewicz Date: Sun, 8 Mar 2020 16:21:42 +0000 Subject: [PATCH] Fix for fonts with no kerning tables Apply deltas even if the font has no kerning table --- src/SFML/Graphics/Font.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/SFML/Graphics/Font.cpp b/src/SFML/Graphics/Font.cpp index 7ef2067f..9e2193fc 100644 --- a/src/SFML/Graphics/Font.cpp +++ b/src/SFML/Graphics/Font.cpp @@ -384,7 +384,7 @@ float Font::getKerning(Uint32 first, Uint32 second, unsigned int characterSize) FT_Face face = static_cast(m_face); - if (face && FT_HAS_KERNING(face) && setCurrentSize(characterSize)) + if (face && setCurrentSize(characterSize)) { // Convert the characters to indices FT_UInt index1 = FT_Get_Char_Index(face, first); @@ -396,7 +396,8 @@ float Font::getKerning(Uint32 first, Uint32 second, unsigned int characterSize) // Get the kerning vector FT_Vector kerning; - FT_Get_Kerning(face, index1, index2, FT_KERNING_UNFITTED, &kerning); + if( FT_HAS_KERNING(face)) + FT_Get_Kerning(face, index1, index2, FT_KERNING_UNFITTED, &kerning); // X advance is already in pixels for bitmap fonts if (!FT_IS_SCALABLE(face))