From 3687eb79d6a7de6b09e58a59fbd042ae4af1d0f5 Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Wed, 29 Jul 2015 18:51:03 -0400 Subject: [PATCH] Apply modified version of patch from Benau to fix chinese word wrapping. See #2110 --- lib/irrlicht/source/Irrlicht/CGUIStaticText.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/irrlicht/source/Irrlicht/CGUIStaticText.cpp b/lib/irrlicht/source/Irrlicht/CGUIStaticText.cpp index ea934d3e1..095dd64a0 100644 --- a/lib/irrlicht/source/Irrlicht/CGUIStaticText.cpp +++ b/lib/irrlicht/source/Irrlicht/CGUIStaticText.cpp @@ -11,6 +11,9 @@ #include "IVideoDriver.h" #include "rect.h" +#define CJK_START 12287 +#define CJK_END 40960 + namespace irr { namespace gui @@ -360,6 +363,20 @@ void CGUIStaticText::breakText() { // part of a word 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))