Fix for fonts with no kerning tables

Apply deltas even if the font has no kerning table
This commit is contained in:
Radek Dutkiewicz 2020-03-08 16:21:42 +00:00 committed by Lukas Dürrenberger
parent 7a0c35c334
commit f76f0607c7

View File

@ -384,7 +384,7 @@ float Font::getKerning(Uint32 first, Uint32 second, unsigned int characterSize)
FT_Face face = static_cast<FT_Face>(m_face); FT_Face face = static_cast<FT_Face>(m_face);
if (face && FT_HAS_KERNING(face) && setCurrentSize(characterSize)) if (face && setCurrentSize(characterSize))
{ {
// Convert the characters to indices // Convert the characters to indices
FT_UInt index1 = FT_Get_Char_Index(face, first); FT_UInt index1 = FT_Get_Char_Index(face, first);
@ -396,6 +396,7 @@ float Font::getKerning(Uint32 first, Uint32 second, unsigned int characterSize)
// Get the kerning vector // Get the kerning vector
FT_Vector kerning; FT_Vector kerning;
if( FT_HAS_KERNING(face))
FT_Get_Kerning(face, index1, index2, FT_KERNING_UNFITTED, &kerning); FT_Get_Kerning(face, index1, index2, FT_KERNING_UNFITTED, &kerning);
// X advance is already in pixels for bitmap fonts // X advance is already in pixels for bitmap fonts