From 52f3551587aad266a794e69416a9662023e55e0f Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Sun, 10 Aug 2008 18:56:10 +0000 Subject: Bugfix: Several text-drawing issues. Bugfix: Overlapping text in text edit dialogs. svn-id: r33768 --- graphics/VectorRenderer.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'graphics/VectorRenderer.cpp') diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp index e3e7174d90..17a221a725 100644 --- a/graphics/VectorRenderer.cpp +++ b/graphics/VectorRenderer.cpp @@ -323,23 +323,24 @@ inline uint32 fp_sqroot(uint32 x) { template void VectorRendererSpec:: drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, - GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV, int deltax) { + GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV, int deltax, bool ellipsis) { - int offset = 0; + int offset = area.top; - switch (alignV) { - case GUI::Theme::kTextAlignVCenter: - offset = area.top + (area.height() - font->getFontHeight()) / 2; - break; - case GUI::Theme::kTextAlignVBottom: - offset = area.bottom - font->getFontHeight(); - break; - case GUI::Theme::kTextAlignVTop: - offset = area.top; - break; + if (font->getFontHeight() < area.height()) { + switch (alignV) { + case GUI::Theme::kTextAlignVCenter: + offset = area.top + ((area.height() - font->getFontHeight()) >> 1); + break; + case GUI::Theme::kTextAlignVBottom: + offset = area.bottom - font->getFontHeight(); + break; + default: + break; + } } - font->drawString(_activeSurface, text, area.left, offset, area.width(), _fgColor, (Graphics::TextAlignment)alignH, deltax, false); + font->drawString(_activeSurface, text, area.left, offset, area.width(), _fgColor, (Graphics::TextAlignment)alignH, deltax, ellipsis); } /** LINES **/ -- cgit v1.2.3