From eec2d64f57a97d9405f52ce1918e5ff46e107bb0 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 14 Mar 2016 12:40:28 -0300 Subject: [PATCH] Replace FreeTypeFont::height() impl --- src/she/common/freetype_font.cpp | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/she/common/freetype_font.cpp b/src/she/common/freetype_font.cpp index 4b83a06a1..ca9d3c5b2 100644 --- a/src/she/common/freetype_font.cpp +++ b/src/she/common/freetype_font.cpp @@ -44,19 +44,8 @@ FontType FreeTypeFont::type() int FreeTypeFont::height() const { - FT_UInt glyph_index = FT_Get_Char_Index(m_face, 'A'); - - FT_Error err = FT_Load_Glyph( - m_face, glyph_index, - FT_LOAD_RENDER | - FT_LOAD_NO_BITMAP | - (m_face.antialias() ? FT_LOAD_TARGET_NORMAL: - FT_LOAD_TARGET_MONO)); - - if (!err) - return (int)m_face->glyph->bitmap.rows; - else - return m_face->height >> 6; + static std::string str = "Tgjp"; + return m_face.calcTextBounds(str.begin(), str.end()).h; } int FreeTypeFont::charWidth(int chr) const