(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

pull/155/head
rubidium 11 years ago
parent c943830155
commit e284bb2470

@ -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) {

Loading…
Cancel
Save