Painter::TextAlignment::Center vertical fix.

This commit is contained in:
Andreas Kling 2018-10-12 16:57:43 +02:00
parent 0dcdbe3e03
commit ff0ce2b921
Notes: sideshowbarker 2024-07-19 18:50:01 +09:00

View file

@ -105,7 +105,7 @@ void Painter::drawText(const Rect& rect, const String& text, TextAlignment align
} else if (alignment == TextAlignment::Center) {
int textWidth = text.length() * m_font.glyphWidth();
point = rect.center();
point.moveBy(-(textWidth / 2), -(m_font.glyphWidth() / 2));
point.moveBy(-(textWidth / 2), -(m_font.glyphHeight() / 2));
} else {
ASSERT_NOT_REACHED();
}