diff options
author | v-rob <robinsonvincent89@gmail.com> | 2020-08-11 11:07:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-11 20:07:17 +0200 |
commit | cd0e213a3640e980e15735f97dd874754f0dc679 (patch) | |
tree | 7dc5e132a883edc4631233612f8855f5267da7e2 /src/gui/guiTable.cpp | |
parent | abfea69e5f68c0f2c946bfcd4444f8cb32e781cf (diff) | |
download | minetest-cd0e213a3640e980e15735f97dd874754f0dc679.tar.gz minetest-cd0e213a3640e980e15735f97dd874754f0dc679.tar.bz2 minetest-cd0e213a3640e980e15735f97dd874754f0dc679.zip |
Add font styling options to tables and textlists (#10203)
Diffstat (limited to 'src/gui/guiTable.cpp')
-rw-r--r-- | src/gui/guiTable.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/gui/guiTable.cpp b/src/gui/guiTable.cpp index c705e17fb..cab2e19fd 100644 --- a/src/gui/guiTable.cpp +++ b/src/gui/guiTable.cpp @@ -56,7 +56,7 @@ GUITable::GUITable(gui::IGUIEnvironment *env, m_font = skin->getFont(); if (m_font) { m_font->grab(); - m_rowheight = m_font->getDimension(L"A").Height + 4; + m_rowheight = m_font->getDimension(L"Ay").Height + 4; m_rowheight = MYMAX(m_rowheight, 1); } @@ -586,6 +586,31 @@ void GUITable::setSelected(s32 index) } } +void GUITable::setOverrideFont(IGUIFont *font) +{ + if (m_font == font) + return; + + if (font == nullptr) + font = Environment->getSkin()->getFont(); + + if (m_font) + m_font->drop(); + + m_font = font; + m_font->grab(); + + m_rowheight = m_font->getDimension(L"Ay").Height + 4; + m_rowheight = MYMAX(m_rowheight, 1); + + updateScrollBar(); +} + +IGUIFont *GUITable::getOverrideFont() const +{ + return m_font; +} + GUITable::DynamicData GUITable::getDynamicData() const { DynamicData dyndata; |