aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/font.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-01-24 18:31:54 -0500
committerPaul Gilbert2015-01-24 18:31:54 -0500
commit0d8d66cb82c4b6236af4b05e36f5a69461597580 (patch)
treed71c8f1b1d87c5f1f176a49a133b56478aa2a5f4 /engines/xeen/font.cpp
parentf742dc8d33abda26e47ebd4c73aa8b901e69d608 (diff)
downloadscummvm-rg350-0d8d66cb82c4b6236af4b05e36f5a69461597580.tar.gz
scummvm-rg350-0d8d66cb82c4b6236af4b05e36f5a69461597580.tar.bz2
scummvm-rg350-0d8d66cb82c4b6236af4b05e36f5a69461597580.zip
XEEN: Fix center aligning text in writeString
Diffstat (limited to 'engines/xeen/font.cpp')
-rw-r--r--engines/xeen/font.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/engines/xeen/font.cpp b/engines/xeen/font.cpp
index aee05f9066..1668ef5ae8 100644
--- a/engines/xeen/font.cpp
+++ b/engines/xeen/font.cpp
@@ -113,8 +113,10 @@ Common::String FontSurface::writeString(const Common::String &s, const Common::R
}
} else {
// Found word break, find end of previous word
- while (displayEnd > _displayString && (*displayEnd & 0x7f) == ' ')
- --displayEnd;
+ while (endP > _displayString && (*endP & 0x7f) == ' ')
+ --endP;
+
+ displayEnd = endP;
}
}
@@ -123,9 +125,12 @@ Common::String FontSurface::writeString(const Common::String &s, const Common::R
// Figure out the width of the selected portion of the string
int totalWidth = 0;
while (!getNextCharWidth(totalWidth)) {
- if (_displayString > displayEnd && *displayEnd == ' ') {
- // Don't include any ending space as part of the total
- totalWidth -= _fontReduced ? 4 : 5;
+ if (_displayString > displayEnd) {
+ if (*displayEnd == ' ') {
+ // Don't include any ending space as part of the total
+ totalWidth -= _fontReduced ? 4 : 5;
+ }
+ break;
}
}