mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Formspec: Fix incorrect cell size when using non-default fonts (#16178)
This commit is contained in:
parent
da7897a822
commit
94a9b94baf
2 changed files with 6 additions and 6 deletions
|
@ -1235,10 +1235,14 @@ void GUIFormSpecMenu::parseTable(parserData* data, const std::string &element)
|
||||||
item = wide_to_utf8(unescape_translate(utf8_to_wide(unescape_string(item))));
|
item = wide_to_utf8(unescape_translate(utf8_to_wide(unescape_string(item))));
|
||||||
}
|
}
|
||||||
|
|
||||||
//now really show table
|
|
||||||
GUITable *e = new GUITable(Environment, data->current_parent, spec.fid,
|
GUITable *e = new GUITable(Environment, data->current_parent, spec.fid,
|
||||||
rect, m_tsrc);
|
rect, m_tsrc);
|
||||||
|
|
||||||
|
// Apply styling before calculating the cell sizes
|
||||||
|
auto style = getDefaultStyleForElement("table", name);
|
||||||
|
e->setNotClipped(style.getBool(StyleSpec::NOCLIP, false));
|
||||||
|
e->setOverrideFont(style.getFont());
|
||||||
|
|
||||||
if (spec.fname == m_focused_element) {
|
if (spec.fname == m_focused_element) {
|
||||||
Environment->setFocus(e);
|
Environment->setFocus(e);
|
||||||
}
|
}
|
||||||
|
@ -1252,10 +1256,6 @@ void GUIFormSpecMenu::parseTable(parserData* data, const std::string &element)
|
||||||
if (!str_initial_selection.empty() && str_initial_selection != "0")
|
if (!str_initial_selection.empty() && str_initial_selection != "0")
|
||||||
e->setSelected(stoi(str_initial_selection));
|
e->setSelected(stoi(str_initial_selection));
|
||||||
|
|
||||||
auto style = getDefaultStyleForElement("table", name);
|
|
||||||
e->setNotClipped(style.getBool(StyleSpec::NOCLIP, false));
|
|
||||||
e->setOverrideFont(style.getFont());
|
|
||||||
|
|
||||||
m_tables.emplace_back(spec, e);
|
m_tables.emplace_back(spec, e);
|
||||||
m_fields.push_back(spec);
|
m_fields.push_back(spec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ public:
|
||||||
void setTextList(const std::vector<std::string> &content,
|
void setTextList(const std::vector<std::string> &content,
|
||||||
bool transparent);
|
bool transparent);
|
||||||
|
|
||||||
/* Set generic table options, columns and content */
|
/** Set generic table options, columns and content, calculate cell sizes */
|
||||||
// Adds empty strings to end of content if there is an incomplete row
|
// Adds empty strings to end of content if there is an incomplete row
|
||||||
void setTable(const TableOptions &options,
|
void setTable(const TableOptions &options,
|
||||||
const TableColumns &columns,
|
const TableColumns &columns,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue