From 95f02a8f9a3de18fc42b3cc379fbb56b1218f9a5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 26 Dec 2019 17:58:52 +0100 Subject: GRAPHICS: MACGUI: Use proper width when rendering MacText --- graphics/macgui/mactext.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp index 14eb411a23..cb520652b6 100644 --- a/graphics/macgui/mactext.cpp +++ b/graphics/macgui/mactext.cpp @@ -335,6 +335,8 @@ void MacText::render(int from, int to) { from = MAX(0, from); to = MIN(to, _textLines.size() - 1); + int w = MIN(_maxWidth, _textMaxWidth); + // Clear the screen _surface->fillRect(Common::Rect(0, _textLines[from].y, _surface->w, _textLines[to].y + getLineHeight(to)), _bgcolor); @@ -352,7 +354,7 @@ void MacText::render(int from, int to) { if (_textLines[i].chunks[j].text.empty()) continue; - _textLines[i].chunks[j].getFont()->drawString(_surface, _textLines[i].chunks[j].text, xOffset, _textLines[i].y, _maxWidth, _fgcolor); + _textLines[i].chunks[j].getFont()->drawString(_surface, _textLines[i].chunks[j].text, xOffset, _textLines[i].y, w, _fgcolor); xOffset += _textLines[i].chunks[j].getFont()->getStringWidth(_textLines[i].chunks[j].text); } } -- cgit v1.2.3