diff options
-rw-r--r-- | graphics/macgui/mactext.cpp | 11 | ||||
-rw-r--r-- | graphics/macgui/mactext.h | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp index 11dd7d22fe..84db1c2b4a 100644 --- a/graphics/macgui/mactext.cpp +++ b/graphics/macgui/mactext.cpp @@ -129,7 +129,9 @@ void MacText::splitString(Common::String &str) { if (*s == '\r' || *s == '\n' || nextChunk) { Common::Array<Common::String> text; - _font->wordWrapText(tmp, _maxWidth, text); + int w = getLineWidth(curLine, true); + + _font->wordWrapText(tmp, _maxWidth, text, w); tmp.clear(); if (text.size()) { @@ -178,8 +180,9 @@ void MacText::splitString(Common::String &str) { if (tmp.size()) { Common::Array<Common::String> text; + int w = getLineWidth(curLine, true); - _font->wordWrapText(tmp, _maxWidth, text); + _font->wordWrapText(tmp, _maxWidth, text, w); _textLines[curLine].chunks[curChunk].text = text[0]; @@ -260,11 +263,11 @@ void MacText::render(int from, int to) { } } -int MacText::getLineWidth(int line) { +int MacText::getLineWidth(int line, bool enforce) { if ((uint)line >= _textLines.size()) return 0; - if (_textLines[line].width != -1) + if (_textLines[line].width != -1 && !enforce) return _textLines[line].width; int width = 0; diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h index 90f85e6b22..2ce0c3065b 100644 --- a/graphics/macgui/mactext.h +++ b/graphics/macgui/mactext.h @@ -105,7 +105,7 @@ private: void render(int from, int to); void recalcDims(); void reallocSurface(); - int getLineWidth(int line); + int getLineWidth(int line, bool enforce = false); int getLineHeight(int line); private: |