Commit ca6ff4b0 authored by cutealien's avatar cutealien

Merge branch releases/1.8 revisions 4749 to 4772 into trunk:

- IGUIStaticText::getTextHeight returns now the correct height for texts with newlines even WordWrap is not set.
- Crashfix for CGUIEditBox. CGUIEditBox::setMultiLine must break text when changed or other functions like getTextDimension can crash afterward for strings with newline characters.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4773 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 40a3df3b
...@@ -57,6 +57,8 @@ Changes in 1.9 (not yet released) ...@@ -57,6 +57,8 @@ Changes in 1.9 (not yet released)
-------------------------- --------------------------
Changes in 1.8.2 Changes in 1.8.2
- IGUIStaticText::getTextHeight returns now the correct height for texts with newlines even WordWrap is not set.
- Crashfix for CGUIEditBox. CGUIEditBox::setMultiLine must break text when changed or other functions like getTextDimension can crash afterward for strings with newline characters.
- CGUIEditBox and the GUI-Editor now convert pasted text correctly using mbstowcs. - CGUIEditBox and the GUI-Editor now convert pasted text correctly using mbstowcs.
- C::B project files work again on newer Linux-distributions which have cleaned up their dev-lib dependencies. - C::B project files work again on newer Linux-distributions which have cleaned up their dev-lib dependencies.
- Makefile for the new IrrFontTool links now correctly to libfontconfig - Makefile for the new IrrFontTool links now correctly to libfontconfig
......
...@@ -190,6 +190,7 @@ bool CGUIEditBox::isWordWrapEnabled() const ...@@ -190,6 +190,7 @@ bool CGUIEditBox::isWordWrapEnabled() const
void CGUIEditBox::setMultiLine(bool enable) void CGUIEditBox::setMultiLine(bool enable)
{ {
MultiLine = enable; MultiLine = enable;
breakText();
} }
......
...@@ -542,12 +542,18 @@ s32 CGUIStaticText::getTextHeight() const ...@@ -542,12 +542,18 @@ s32 CGUIStaticText::getTextHeight() const
if (!font) if (!font)
return 0; return 0;
s32 height = font->getDimension(L"A").Height + font->getKerningHeight();
if (WordWrap) if (WordWrap)
height *= BrokenText.size(); {
s32 height = font->getDimension(L"A").Height + font->getKerningHeight();
return height; return height* BrokenText.size();
}
else
{
// TODO: Text can have multiple lines which are not in BrokenText
// This is likely not correct. But as I have no time for further
// investigation I just fix it for now by return the true height here.
return font->getDimension(Text.c_str()).Height;
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment