@@ -24,8 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
24
24
#include < limits>
25
25
#include < sstream>
26
26
#include " guiFormSpecMenu.h"
27
- #include " guiScrollBar.h"
28
- #include " guiTable.h"
29
27
#include " constants.h"
30
28
#include " gamedef.h"
31
29
#include " client/keycode.h"
@@ -64,9 +62,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
64
62
#include " guiEditBoxWithScrollbar.h"
65
63
#include " guiInventoryList.h"
66
64
#include " guiItemImage.h"
67
- #include " guiScrollBar.h"
68
65
#include " guiScrollContainer.h"
69
- #include " guiTable.h"
70
66
#include " intlGUIEditBox.h"
71
67
#include " guiHyperText.h"
72
68
@@ -1482,6 +1478,7 @@ void GUIFormSpecMenu::parsePwdField(parserData* data, const std::string &element
1482
1478
e->setNotClipped (style.getBool (StyleSpec::NOCLIP, false ));
1483
1479
e->setDrawBorder (style.getBool (StyleSpec::BORDER, true ));
1484
1480
e->setOverrideColor (style.getColor (StyleSpec::TEXTCOLOR, video::SColor (0xFFFFFFFF )));
1481
+ e->setOverrideFont (style.getFont ());
1485
1482
1486
1483
irr::SEvent evt;
1487
1484
evt.EventType = EET_KEY_INPUT_EVENT;
@@ -1565,6 +1562,7 @@ void GUIFormSpecMenu::createTextField(parserData *data, FieldSpec &spec,
1565
1562
if (style.get (StyleSpec::BGCOLOR, " " ) == " transparent" ) {
1566
1563
e->setDrawBackground (false );
1567
1564
}
1565
+ e->setOverrideFont (style.getFont ());
1568
1566
1569
1567
e->drop ();
1570
1568
}
@@ -1778,6 +1776,11 @@ void GUIFormSpecMenu::parseLabel(parserData* data, const std::string &element)
1778
1776
1779
1777
std::vector<std::string> lines = split (text, ' \n ' );
1780
1778
1779
+ auto style = getDefaultStyleForElement (" label" , " " );
1780
+ gui::IGUIFont *font = style.getFont ();
1781
+ if (!font)
1782
+ font = m_font;
1783
+
1781
1784
for (unsigned int i = 0 ; i != lines.size (); i++) {
1782
1785
std::wstring wlabel_colors = translate_string (
1783
1786
utf8_to_wide (unescape_string (lines[i])));
@@ -1799,7 +1802,7 @@ void GUIFormSpecMenu::parseLabel(parserData* data, const std::string &element)
1799
1802
1800
1803
rect = core::rect<s32>(
1801
1804
pos.X , pos.Y ,
1802
- pos.X + m_font ->getDimension (wlabel_plain.c_str ()).Width ,
1805
+ pos.X + font ->getDimension (wlabel_plain.c_str ()).Width ,
1803
1806
pos.Y + imgsize.Y );
1804
1807
1805
1808
} else {
@@ -1821,7 +1824,7 @@ void GUIFormSpecMenu::parseLabel(parserData* data, const std::string &element)
1821
1824
1822
1825
rect = core::rect<s32>(
1823
1826
pos.X , pos.Y - m_btn_height,
1824
- pos.X + m_font ->getDimension (wlabel_plain.c_str ()).Width ,
1827
+ pos.X + font ->getDimension (wlabel_plain.c_str ()).Width ,
1825
1828
pos.Y + m_btn_height);
1826
1829
}
1827
1830
@@ -1837,9 +1840,9 @@ void GUIFormSpecMenu::parseLabel(parserData* data, const std::string &element)
1837
1840
spec.fid );
1838
1841
e->setTextAlignment (gui::EGUIA_UPPERLEFT, gui::EGUIA_CENTER);
1839
1842
1840
- auto style = getDefaultStyleForElement (" label" , spec.fname );
1841
1843
e->setNotClipped (style.getBool (StyleSpec::NOCLIP, false ));
1842
1844
e->setOverrideColor (style.getColor (StyleSpec::TEXTCOLOR, video::SColor (0xFFFFFFFF )));
1845
+ e->setOverrideFont (font);
1843
1846
1844
1847
m_fields.push_back (spec);
1845
1848
@@ -1867,6 +1870,11 @@ void GUIFormSpecMenu::parseVertLabel(parserData* data, const std::string &elemen
1867
1870
1868
1871
MY_CHECKPOS (" vertlabel" ,1 );
1869
1872
1873
+ auto style = getDefaultStyleForElement (" vertlabel" , " " , " label" );
1874
+ gui::IGUIFont *font = style.getFont ();
1875
+ if (!font)
1876
+ font = m_font;
1877
+
1870
1878
v2s32 pos;
1871
1879
core::rect<s32> rect;
1872
1880
@@ -1880,7 +1888,7 @@ void GUIFormSpecMenu::parseVertLabel(parserData* data, const std::string &elemen
1880
1888
// isn't quite tall enough and cuts off the text.
1881
1889
rect = core::rect<s32>(pos.X , pos.Y ,
1882
1890
pos.X + imgsize.X ,
1883
- pos.Y + font_line_height (m_font ) *
1891
+ pos.Y + font_line_height (font ) *
1884
1892
(text.length () + 1 ));
1885
1893
1886
1894
} else {
@@ -1892,7 +1900,7 @@ void GUIFormSpecMenu::parseVertLabel(parserData* data, const std::string &elemen
1892
1900
rect = core::rect<s32>(
1893
1901
pos.X , pos.Y +((imgsize.Y /2 ) - m_btn_height),
1894
1902
pos.X +15 , pos.Y +
1895
- font_line_height (m_font ) *
1903
+ font_line_height (font ) *
1896
1904
(text.length () + 1 ) +
1897
1905
((imgsize.Y /2 ) - m_btn_height));
1898
1906
}
@@ -1917,9 +1925,9 @@ void GUIFormSpecMenu::parseVertLabel(parserData* data, const std::string &elemen
1917
1925
rect, false , false , data->current_parent , spec.fid );
1918
1926
e->setTextAlignment (gui::EGUIA_CENTER, gui::EGUIA_CENTER);
1919
1927
1920
- auto style = getDefaultStyleForElement (" vertlabel" , spec.fname , " label" );
1921
1928
e->setNotClipped (style.getBool (StyleSpec::NOCLIP, false ));
1922
1929
e->setOverrideColor (style.getColor (StyleSpec::TEXTCOLOR, video::SColor (0xFFFFFFFF )));
1930
+ e->setOverrideFont (font);
1923
1931
1924
1932
m_fields.push_back (spec);
1925
1933
0 commit comments