diff options
author | SmallJoker <mk939@ymail.com> | 2019-09-29 14:52:21 +0200 |
---|---|---|
committer | SmallJoker <mk939@ymail.com> | 2019-09-29 14:52:41 +0200 |
commit | c2458d3d3a7f1ce309861e237fa52c13b7342e34 (patch) | |
tree | 8bd245146d79ae586ae6710076cef6e89398e3ca /src | |
parent | 3799ffd9d517aa19d41c5195cf52a3ddc29f7f72 (diff) | |
download | minetest-c2458d3d3a7f1ce309861e237fa52c13b7342e34.tar.gz minetest-c2458d3d3a7f1ce309861e237fa52c13b7342e34.tar.bz2 minetest-c2458d3d3a7f1ce309861e237fa52c13b7342e34.zip |
label[]: Fix broken colors since 2c9edef
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/guiFormSpecMenu.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index ebcc6b67e..9dacf37d7 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -1405,8 +1405,10 @@ void GUIFormSpecMenu::parseLabel(parserData* data, const std::string &element) std::vector<std::string> lines = split(text, '\n'); for (unsigned int i = 0; i != lines.size(); i++) { - std::wstring wlabel = unescape_translate(unescape_string( - utf8_to_wide(lines[i]))); + std::wstring wlabel_colors = translate_string( + utf8_to_wide(unescape_string(lines[i]))); + // Without color escapes to get the font dimensions + std::wstring wlabel_plain = unescape_enriched(wlabel_colors); core::rect<s32> rect; @@ -1423,7 +1425,7 @@ void GUIFormSpecMenu::parseLabel(parserData* data, const std::string &element) rect = core::rect<s32>( pos.X, pos.Y, - pos.X + m_font->getDimension(wlabel.c_str()).Width, + pos.X + m_font->getDimension(wlabel_plain.c_str()).Width, pos.Y + imgsize.Y); } else { @@ -1445,13 +1447,13 @@ void GUIFormSpecMenu::parseLabel(parserData* data, const std::string &element) rect = core::rect<s32>( pos.X, pos.Y - m_btn_height, - pos.X + m_font->getDimension(wlabel.c_str()).Width, + pos.X + m_font->getDimension(wlabel_plain.c_str()).Width, pos.Y + m_btn_height); } FieldSpec spec( "", - wlabel, + wlabel_colors, L"", 258+m_fields.size() ); |