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