mirror of
https://github.com/love2d/love.git
synced 2026-08-19 20:19:42 +02:00
Hopefully fixed Font baseline calculation.
--HG-- branch : minor
This commit is contained in:
@@ -914,9 +914,11 @@ int Font::getDescent() const
|
|||||||
|
|
||||||
float Font::getBaseline() const
|
float Font::getBaseline() const
|
||||||
{
|
{
|
||||||
// 1.25 is magic line height for true type fonts
|
float ascent = getAscent();
|
||||||
if (rasterizers[0]->getDataType() == font::Rasterizer::DATA_TRUETYPE)
|
if (ascent != 0.0f)
|
||||||
return floorf(getHeight() / 1.25f + 0.5f);
|
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
|
else
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user