aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorEugene Sandulenko2017-02-01 19:06:36 +0100
committerEugene Sandulenko2017-02-01 19:06:36 +0100
commitd39404c8e8144af504f8a4dfef69f2009c05582e (patch)
tree9a296c674d7cf9d2188d83b0a15bacbd8c28b94d /graphics
parent6e3e8911c1a065867d4d6000f42f5d05ca5fec4a (diff)
downloadscummvm-rg350-d39404c8e8144af504f8a4dfef69f2009c05582e.tar.gz
scummvm-rg350-d39404c8e8144af504f8a4dfef69f2009c05582e.tar.bz2
scummvm-rg350-d39404c8e8144af504f8a4dfef69f2009c05582e.zip
GRAPHICS: Fix rendering of MacText with font change in the middle of the string
Diffstat (limited to 'graphics')
-rw-r--r--graphics/macgui/mactext.cpp11
-rw-r--r--graphics/macgui/mactext.h2
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: