From 92f276f26d9a61734a79c774ba1150db82dee86c Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 30 Jun 2013 07:46:10 +0000 Subject: (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 --- src/gfx_layout.cpp | 11 +++++------ 1 file 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) { -- cgit v1.2.3-70-g09d2