diff options
Diffstat (limited to 'src/gfx_layout.cpp')
-rw-r--r-- | src/gfx_layout.cpp | 11 |
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) { |