diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-09-20 22:17:21 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2007-09-20 22:17:21 +0000 |
commit | 7b67e852086ad3ccd98a622f890b245ab6a0a321 (patch) | |
tree | f7341709ff3119209cc69bb114aec5ff95447d8a /src/gui/browserbox.cpp | |
parent | 9cfafa755012bfd68c661996ddaea76e2e265f81 (diff) | |
download | mana-7b67e852086ad3ccd98a622f890b245ab6a0a321.tar.gz mana-7b67e852086ad3ccd98a622f890b245ab6a0a321.tar.bz2 mana-7b67e852086ad3ccd98a622f890b245ab6a0a321.tar.xz mana-7b67e852086ad3ccd98a622f890b245ab6a0a321.zip |
Added support for unicode charset in textfields and chat.
Diffstat (limited to 'src/gui/browserbox.cpp')
-rw-r--r-- | src/gui/browserbox.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index 717342de..9c31c752 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -273,6 +273,8 @@ BrowserBox::draw(gcn::Graphics *graphics) std::string row = mTextRows[i]; x = 0; + /* FIXME: This code has to be rewritten from scratch, so that it does + not display strings one character at a time. */ for (j = 0; j < row.size(); j++) { if (mUseLinksAndUserColors || (!mUseLinksAndUserColors && (j == 0))) @@ -354,7 +356,11 @@ BrowserBox::draw(gcn::Graphics *graphics) // Draw each char else { - std::string character = row.substr(j, 1); + unsigned j_end = j + 1; + while (j_end < row.size() && (row[j_end] & 192) == 128) + ++j_end; + std::string character = row.substr(j, j_end - j); + j = j_end - 1; font->drawString(graphics, character, x, y); x += font->getWidth(character.c_str()); |