diff --git a/changes.txt b/changes.txt index 841c0305..5158b78b 100644 --- a/changes.txt +++ b/changes.txt @@ -286,6 +286,8 @@ The following names can be queried for the given types: ----------------------------- Changes in 1.7.3 (??.??.2011) + - Fix problems in Textwrapping in CGUIStaticText. Did use wrong size and did ignore last word of the text in wrapping (thx @ Reiko for bugreport) + - Fix crash in collada (.dae) loading - Fix memory-leaks in example 22 MaterialViewer diff --git a/source/Irrlicht/CGUIStaticText.cpp b/source/Irrlicht/CGUIStaticText.cpp index 700b1d7f..42445ecd 100644 --- a/source/Irrlicht/CGUIStaticText.cpp +++ b/source/Irrlicht/CGUIStaticText.cpp @@ -288,26 +288,29 @@ void CGUIStaticText::breakText() BrokenText.clear(); + IGUISkin* skin = Environment->getSkin(); IGUIFont* font = getActiveFont(); if (!font) return; LastBreakFont = font; + core::stringw line; + core::stringw word; + core::stringw whitespace; + s32 size = Text.size(); + s32 length = 0; + s32 elWidth = RelativeRect.getWidth(); + if (Border) + elWidth -= 2*skin->getSize(EGDS_TEXT_DISTANCE_X); + wchar_t c; + // We have to deal with right-to-left and left-to-right differently // However, most parts of the following code is the same, it's just // some order and boundaries which change. if (!RightToLeft) { // regular (left-to-right) - core::stringw line; - core::stringw word; - core::stringw whitespace; - s32 size = Text.size(); - s32 length = 0; - s32 elWidth = RelativeRect.getWidth() - 6; - wchar_t c; - for (s32 i=0; i=0; --i) { c = Text[i];