From 61ddc77804279a28f3dc8ebef4c226c78816d689 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Mon, 13 Aug 2012 02:13:26 +0200 Subject: WINTERMUTE: Use the correct DPI for TTF-fonts, and don't display overshooting lines. --- engines/wintermute/base/font/base_font_truetype.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'engines/wintermute') diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp index 00b522c826..4fa5ac08ce 100644 --- a/engines/wintermute/base/font/base_font_truetype.cpp +++ b/engines/wintermute/base/font/base_font_truetype.cpp @@ -248,6 +248,13 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width, Common::Array lines; _font->wordWrapText(text, width, lines); + while (maxHeight > 0 && lines.size() * _lineHeight > maxHeight) { + lines.pop_back(); + } + if (lines.size() == 0) { + return NULL; + } + Graphics::TextAlign alignment = Graphics::kTextAlignInvalid; if (align == TAL_LEFT) { alignment = Graphics::kTextAlignLeft; @@ -553,7 +560,7 @@ bool BaseFontTT::initFont() { if (file) { #ifdef USE_FREETYPE2 - _deletableFont = Graphics::loadTTFFont(*file, _fontHeight * 4 / 3); // Compensate for the difference in dpi (96 vs 72). + _deletableFont = Graphics::loadTTFFont(*file, 96, _fontHeight); // Use the same dpi as WME (96 vs 72). _font = _deletableFont; #endif } -- cgit v1.2.3