Browse Source

Hopefully fixed Font baseline calculation.

--HG--
branch : minor
Alex Szpakowski 8 years ago
parent
commit
0b3b58adb8
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/modules/graphics/Font.cpp

+ 5 - 3
src/modules/graphics/Font.cpp

@@ -914,9 +914,11 @@ int Font::getDescent() const
 
 float Font::getBaseline() const
 {
-	// 1.25 is magic line height for true type fonts
-	if (rasterizers[0]->getDataType() == font::Rasterizer::DATA_TRUETYPE)
-		return floorf(getHeight() / 1.25f + 0.5f);
+	float ascent = getAscent();
+	if (ascent != 0.0f)
+		return ascent;
+	else if (rasterizers[0]->getDataType() == font::Rasterizer::DATA_TRUETYPE)
+		return floorf(getHeight() / 1.25f + 0.5f); // 1.25 is magic line height for true type fonts
 	else
 		return 0.0f;
 }