summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-06-30 07:46:10 +0000
committerrubidium <rubidium@openttd.org>2013-06-30 07:46:10 +0000
commit92f276f26d9a61734a79c774ba1150db82dee86c (patch)
tree348fc2dd74e461fd562efcd95339d6ab545f5277
parent4fed658a63f53a14de7de6eb4372742ff5c231c3 (diff)
downloadopenttd-92f276f26d9a61734a79c774ba1150db82dee86c.tar.xz
(svn r25526) -Fix: line breaking in fallback layouter was off-by-one, so sometimes strings that needed to be broken off earlier got truncated later on
-rw-r--r--src/gfx_layout.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp
index c8286a04b..6ce6078eb 100644
--- a/src/gfx_layout.cpp
+++ b/src/gfx_layout.cpp
@@ -310,7 +310,8 @@ ParagraphLayout::Line *ParagraphLayout::nextLine(int max_width)
const WChar *next_run = this->buffer_begin + iter->first;
for (;;) {
- WChar c = *this->buffer++;
+ WChar c = *this->buffer;
+ last_char = this->buffer;
if (c == '\0') {
this->buffer = NULL;
@@ -325,14 +326,11 @@ ParagraphLayout::Line *ParagraphLayout::nextLine(int max_width)
next_run = this->buffer_begin + iter->first;
begin = this->buffer;
- last_char = begin;
last_space = NULL;
}
if (IsWhitespace(c)) last_space = this->buffer;
- last_char = this->buffer;
-
if (IsPrintable(c) && !IsTextDirectionChar(c)) {
int char_width = GetCharacterWidth(fc->GetSize(), c);
width += char_width;
@@ -353,16 +351,17 @@ ParagraphLayout::Line *ParagraphLayout::nextLine(int max_width)
* Korean. For other languages terminating mid-word might
* not be the best, but terminating the whole string instead
* of continuing the word at the next line is worse. */
- this->buffer--;
last_char = this->buffer;
} else {
/* A space is found; perfect place to terminate */
this->buffer = last_space;
- last_char = last_space - 1;
+ last_char = last_space;
}
break;
}
}
+
+ this->buffer++;
}
if (l->Length() == 0 || last_char - begin != 0) {