aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-08-13 02:13:26 +0200
committerEinar Johan Trøan Sømåen2012-08-13 02:13:26 +0200
commit61ddc77804279a28f3dc8ebef4c226c78816d689 (patch)
tree0d857a168bb31ddf6e3e6407b14259df07ee601e
parentbca8ce861ad3439881fef0f916b592aafc4ee010 (diff)
downloadscummvm-rg350-61ddc77804279a28f3dc8ebef4c226c78816d689.tar.gz
scummvm-rg350-61ddc77804279a28f3dc8ebef4c226c78816d689.tar.bz2
scummvm-rg350-61ddc77804279a28f3dc8ebef4c226c78816d689.zip
WINTERMUTE: Use the correct DPI for TTF-fonts, and don't display overshooting lines.
-rw-r--r--engines/wintermute/base/font/base_font_truetype.cpp9
1 files changed, 8 insertions, 1 deletions
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<Common::String> 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
}