mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
label[]: Fix broken colors since 2c9edef
This commit is contained in:
parent
3799ffd9d5
commit
c2458d3d3a
@ -1405,8 +1405,10 @@ void GUIFormSpecMenu::parseLabel(parserData* data, const std::string &element)
|
|||||||
std::vector<std::string> lines = split(text, '\n');
|
std::vector<std::string> lines = split(text, '\n');
|
||||||
|
|
||||||
for (unsigned int i = 0; i != lines.size(); i++) {
|
for (unsigned int i = 0; i != lines.size(); i++) {
|
||||||
std::wstring wlabel = unescape_translate(unescape_string(
|
std::wstring wlabel_colors = translate_string(
|
||||||
utf8_to_wide(lines[i])));
|
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;
|
core::rect<s32> rect;
|
||||||
|
|
||||||
@ -1423,7 +1425,7 @@ void GUIFormSpecMenu::parseLabel(parserData* data, const std::string &element)
|
|||||||
|
|
||||||
rect = core::rect<s32>(
|
rect = core::rect<s32>(
|
||||||
pos.X, pos.Y,
|
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);
|
pos.Y + imgsize.Y);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -1445,13 +1447,13 @@ void GUIFormSpecMenu::parseLabel(parserData* data, const std::string &element)
|
|||||||
|
|
||||||
rect = core::rect<s32>(
|
rect = core::rect<s32>(
|
||||||
pos.X, pos.Y - m_btn_height,
|
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);
|
pos.Y + m_btn_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
FieldSpec spec(
|
FieldSpec spec(
|
||||||
"",
|
"",
|
||||||
wlabel,
|
wlabel_colors,
|
||||||
L"",
|
L"",
|
||||||
258+m_fields.size()
|
258+m_fields.size()
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user