Apply modified version of patch from Benau to fix chinese word wrapping. See #2110

This commit is contained in:
Marianne Gagnon 2015-07-29 18:51:03 -04:00
parent 75b49b4d4f
commit 3687eb79d6

View File

@ -11,6 +11,9 @@
#include "IVideoDriver.h" #include "IVideoDriver.h"
#include "rect.h" #include "rect.h"
#define CJK_START 12287
#define CJK_END 40960
namespace irr namespace irr
{ {
namespace gui namespace gui
@ -360,6 +363,20 @@ void CGUIStaticText::breakText()
{ {
// part of a word // part of a word
word += c; word += c;
//Check for CJK, show them first if out of range of displaying area
if (Text[i] > CJK_START && Text[i] < CJK_END)
{
const s32 cjklgth = font->getDimension(word.c_str()).Width;
if (cjklgth > (elWidth - 23))
{
BrokenText.push_back(line);
length = cjklgth;
line = word;
word = L"";
whitespace = L"";
}
}
} }
if ( isWhitespace || i == (size-1)) if ( isWhitespace || i == (size-1))