diff options
author | Vicent Marti | 2008-07-10 20:36:02 +0000 |
---|---|---|
committer | Vicent Marti | 2008-07-10 20:36:02 +0000 |
commit | a90be07c3e93014174a3b4f3fa0be25aad227859 (patch) | |
tree | 72b41efdbe6245167332d35908110d63ecb2183b /graphics/VectorRenderer.cpp | |
parent | e0aad7f4be66a9e30f0226c17c9d2bd0a8138898 (diff) | |
download | scummvm-rg350-a90be07c3e93014174a3b4f3fa0be25aad227859.tar.gz scummvm-rg350-a90be07c3e93014174a3b4f3fa0be25aad227859.tar.bz2 scummvm-rg350-a90be07c3e93014174a3b4f3fa0be25aad227859.zip |
Support for Vertical text alignement.
svn-id: r32995
Diffstat (limited to 'graphics/VectorRenderer.cpp')
-rw-r--r-- | graphics/VectorRenderer.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp index 0c1d01213d..8856386819 100644 --- a/graphics/VectorRenderer.cpp +++ b/graphics/VectorRenderer.cpp @@ -75,7 +75,7 @@ void VectorRenderer::textStep(const Common::String &text, const Common::Rect &ar if (step.color.set) setFgColor(step.color.r, step.color.g, step.color.b); - drawString(step.font, text.c_str(), area, step.align); + drawString(step.font, text.c_str(), area, step.alignHorizontal, step.alignVertical); } /******************************************************************** @@ -185,8 +185,24 @@ inline uint32 fp_sqroot(uint32 x) { ********************************************************************/ template <typename PixelType, typename PixelFormat> void VectorRendererSpec<PixelType, PixelFormat>:: -drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign align) { - font->drawString(_activeSurface, text, area.left, area.top, area.width(), _fgColor, (Graphics::TextAlignment)align, 0, false); +drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, + GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV) { + + int offset = 0; + + 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; + } + + font->drawString(_activeSurface, text, area.left, offset, area.width(), _fgColor, (Graphics::TextAlignment)alignH, 0, false); } /** LINES **/ |