mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-20 11:35:21 +02:00
IGUIFont / CGUITTFont code cleanups (#15581)
This commit is contained in:
@@ -74,10 +74,12 @@ void CGUIStaticText::draw()
|
||||
IGUIFont *font = getActiveFont();
|
||||
|
||||
if (font) {
|
||||
s32 kerningHeight = font->getKerning(L'A').Y;
|
||||
|
||||
if (!WordWrap) {
|
||||
if (VAlign == EGUIA_LOWERRIGHT) {
|
||||
frameRect.UpperLeftCorner.Y = frameRect.LowerRightCorner.Y -
|
||||
font->getDimension(L"A").Height - font->getKerningHeight();
|
||||
font->getDimension(L"A").Height - kerningHeight;
|
||||
}
|
||||
if (HAlign == EGUIA_LOWERRIGHT) {
|
||||
frameRect.UpperLeftCorner.X = frameRect.LowerRightCorner.X -
|
||||
@@ -92,7 +94,7 @@ void CGUIStaticText::draw()
|
||||
breakText();
|
||||
|
||||
core::rect<s32> r = frameRect;
|
||||
s32 height = font->getDimension(L"A").Height + font->getKerningHeight();
|
||||
s32 height = font->getDimension(L"A").Height + kerningHeight;
|
||||
s32 totalHeight = height * BrokenText.size();
|
||||
if (VAlign == EGUIA_CENTER) {
|
||||
r.UpperLeftCorner.Y = r.getCenter().Y - (totalHeight / 2);
|
||||
@@ -471,7 +473,7 @@ s32 CGUIStaticText::getTextHeight() const
|
||||
return 0;
|
||||
|
||||
if (WordWrap) {
|
||||
s32 height = font->getDimension(L"A").Height + font->getKerningHeight();
|
||||
s32 height = font->getDimension(L"A").Height + font->getKerning(L'A').Y;
|
||||
return height * BrokenText.size();
|
||||
} else {
|
||||
// TODO: Text can have multiple lines which are not in BrokenText
|
||||
|
Reference in New Issue
Block a user