From 82182aeb9eacb3a6e10e34b34b46ef63222ecd7d Mon Sep 17 00:00:00 2001 From: Björn Steinbrink Date: Tue, 25 Sep 2007 16:28:25 +0000 Subject: Fix wrapping of UTF-8 multi-byte characters. --- ChangeLog | 4 ++++ src/gui/browserbox.cpp | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3a5a424d..db575fcb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-09-25 Björn Steinbrink + + * src/gui/browserbox.cpp: Fix wrapping of UTF-8 multi-byte characters. + 2007-09-25 Bjørn Lindeijer * src/inventory.h, src/inventory.cpp: Added some const qualifiers. diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index 18853221..262d9c31 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -386,7 +386,10 @@ BrowserBox::draw(gcn::Graphics *graphics) continue; } - end--; + // Skip to the start of the current character + while ((row[end] & 192) == 128) + end--; + end--; // And then to the last byte of the previous one part = row.substr(start, end - start + 1); } while ((x + font->getWidth(part.c_str()) + 10) > getWidth()); -- cgit v1.2.3-70-g09d2