1
0
Fork 0
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:
SmallJoker 2025-05-27 18:47:41 +02:00 committed by GitHub
parent da7897a822
commit 94a9b94baf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -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))));
}
//now really show table
GUITable *e = new GUITable(Environment, data->current_parent, spec.fid,
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) {
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")
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_fields.push_back(spec);
}

View file

@ -85,7 +85,7 @@ public:
void setTextList(const std::vector<std::string> &content,
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
void setTable(const TableOptions &options,
const TableColumns &columns,