From f7679dca8c3e0fc07d29376be49188e318273200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Einar=20Johan=20Tr=C3=B8an=20S=C3=B8ma=CC=8Aen?= Date: Fri, 8 Jun 2012 18:44:57 +0200 Subject: [PATCH] WINTERMUTE: Align TTF's properly. --- engines/wintermute/Base/BFontTT.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/engines/wintermute/Base/BFontTT.cpp b/engines/wintermute/Base/BFontTT.cpp index 68645e88bb6..9b05790876f 100644 --- a/engines/wintermute/Base/BFontTT.cpp +++ b/engines/wintermute/Base/BFontTT.cpp @@ -250,6 +250,15 @@ CBSurface *CBFontTT::RenderTextToTexture(const WideString &text, int width, TTex Common::Array lines; _font->wordWrapText(text, width, lines); + Graphics::TextAlign alignment = Graphics::kTextAlignInvalid; + if (align == TAL_LEFT) { + alignment = Graphics::kTextAlignLeft; + } else if (align == TAL_CENTER) { + alignment = Graphics::kTextAlignCenter; + } else if (align == TAL_RIGHT) { + alignment = Graphics::kTextAlignRight; + } + warning("CBFontTT::RenderTextToTexture - Not fully ported yet"); warning("%s %d %d %d %d", text.c_str(), D3DCOLGetR(_layers[0]->_color), D3DCOLGetG(_layers[0]->_color),D3DCOLGetB(_layers[0]->_color),D3DCOLGetA(_layers[0]->_color)); // void drawString(Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlign align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true) const; @@ -260,7 +269,7 @@ CBSurface *CBFontTT::RenderTextToTexture(const WideString &text, int width, TTex Common::Array::iterator it; int heightOffset = 0; for (it = lines.begin(); it != lines.end(); it++) { - _font->drawString(surface, *it, 0, heightOffset, width, useColor); + _font->drawString(surface, *it, 0, heightOffset, width, useColor, alignment); heightOffset += _lineHeight; }