aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMartin Kiewitz2010-04-24 12:49:22 +0000
committerMartin Kiewitz2010-04-24 12:49:22 +0000
commit02b9b1019932796156c791f568d05a51b9c942c0 (patch)
tree9c0c0091e2b505b55f286378e3dd6b3654737c6c /engines/sci
parent666fefc79ddfbeb944b1c2e6fd7657528a78c12c (diff)
downloadscummvm-rg350-02b9b1019932796156c791f568d05a51b9c942c0.tar.gz
scummvm-rg350-02b9b1019932796156c791f568d05a51b9c942c0.tar.bz2
scummvm-rg350-02b9b1019932796156c791f568d05a51b9c942c0.zip
SCI: change the way we handle breaking spaces based on how sierra sci does it, revert r48778/r48779
svn-id: r48781
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/graphics/text16.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp
index 3d9db746af..cac20865ac 100644
--- a/engines/sci/graphics/text16.cpp
+++ b/engines/sci/graphics/text16.cpp
@@ -157,7 +157,7 @@ static const uint16 text16_punctuationSjis[] = {
0x4083, 0x4283, 0x4483, 0x4683, 0x4883, 0x6283, 0x8383, 0x8583, 0x8783, 0x8E83, 0x9583, 0x9683,
0x5B81, 0x4181, 0x4281, 0x7681, 0x7881, 0x4981, 0x4881, 0 };
-// return max # of chars to fit maxwidth with full words
+// return max # of chars to fit maxwidth with full words, does not include breaking space
int16 GfxText16::GetLongest(const char *text, int16 maxWidth, GuiResourceId orgFontId) {
uint16 curChar;
int16 maxChars = 0, curCharCount = 0;
@@ -205,7 +205,7 @@ int16 GfxText16::GetLongest(const char *text, int16 maxWidth, GuiResourceId orgF
return curCharCount;
case ' ':
- maxChars = curCharCount + 1;
+ maxChars = curCharCount; // return count up to (but not including) breaking space
break;
}
width += _font->getCharWidth(curChar);
@@ -267,9 +267,6 @@ void GfxText16::Width(const char *text, int16 from, int16 len, GuiResourceId org
break;
}
default:
- // if last character is a space and the text is not ending afterwards, don't add it to textWidth
- if ((curChar == ' ') && (!len) && (*text != 0))
- break;
textHeight = MAX<int16> (textHeight, _ports->_curPort->fontHeight);
textWidth += _font->getCharWidth(curChar);
}
@@ -323,6 +320,8 @@ int16 GfxText16::Size(Common::Rect &rect, const char *text, GuiResourceId fontId
maxTextWidth = MAX(textWidth, maxTextWidth);
totalHeight += textHeight;
curPos += charCount;
+ if (*curPos == ' ')
+ curPos++;
}
rect.bottom = totalHeight;
rect.right = maxWidth ? maxWidth : MIN(rect.right, maxTextWidth);
@@ -436,6 +435,8 @@ void GfxText16::Box(const char *text, int16 bshow, const Common::Rect &rect, Tex
hline += textHeight;
text += charCount;
+ if (*text == ' ')
+ text++;
}
SetFont(orgFontId);
_ports->penColor(orgPenColor);