m_settings(main_settings),
m_env(env),
m_font_cache(),
- m_default_size(),
m_currentMode(FM_Standard),
m_lastMode(),
m_lastSize(0),
m_lastFont(NULL)
{
- for ( unsigned int i = 0; i < FM_MaxMode; i++) {
+ for (unsigned int i = 0; i < FM_MaxMode; i++) {
m_default_size[i] = (FontMode) FONT_SIZE_UNSPECIFIED;
}
std::string font_path = g_settings->get(font_config_prefix + "font_path");
- if (font_path.substr(font_path.length() -4) != ".ttf") {
- errorstream << "FontEngine: \"" << font_path
- << "\" doesn't seem to be a ttf File." << std::endl;
- return;
- }
-
irr::gui::IGUIFont* font = gui::CGUITTFont::createTTFont(m_env,
font_path.c_str(), size, true, true, font_shadow,
font_shadow_alpha);
return;
}
- if ((ending == ".xml") || ( ending == ".png")) {
+ if ((ending == ".xml") || (ending == ".png")) {
basename = font_path.substr(0,font_path.length()-4);
}
}
if (font != NULL) {
+ font->grab();
m_font_cache[mode][basesize] = font;
}
}