Code: Select all
// Load some fonts
IGUIFont *font1 = guienv->getFont(L"font1.png");
IGUIFont *font2 = guienv->getFont(L"font2.png");
// Set default font to font1
guienv->getSkin()->setFont(font1);
// Make a static text, set override font to font2. This works.
guienv->addStaticText(L"Test", rect<s32>(20,20,120,40))->setOverrideFont(font2);
// Make a combo box
IGUIComboBox *combo = guienv->addComboBox(rect<s32>(20,60,120,80));
combo->addItem(L"item 1");
combo->addItem(L"item 2");
combo->addItem(L"item 3");
// Set override font on text part of combo box. Doesn't work, font used will be the skin's default (font1)
irr::core::list<IGUIElement *> kids = combo->getChildren();
for (irr::core::list<IGUIElement *>::Iterator i = kids.begin(); i != kids.end(); ++i)
{
if (((stringc)(*i)->getTypeName()).equals_ignore_case("staticText") == 0)
{
static_cast<IGUIStaticText *>(*i)->setOverrideFont(font2);
}
}
I haven't tried it with others though (eg. list box)