As we are planning on going to Steam Greenlight with our game “Burnt Islands” we decided to have more than just “English” language in the game. As we’ve built our own engine it was not so difficult to implement several languages. The solution (and problem) was CEGUI. It has support for different languages and UTF fonts, but to figure out how to make it work was not so easy.
We have now two languages in “Burnt Islands” – English and Russian. Here we will show you how to make it work with Cyrillic (Russian) fonts.
The first thing you need to do in order to be able to use UNICODE feature in CEGUI is to make sure CEGUI is actually using CEGUI::String as it’s internal string class. Normally this is the default value, but it’s worthwhile to make sure this CMake setting is set to 1.
Next thing you need to do is to set CEGUI up with the right font. In CEGUI documentation it says that “DejaVuSans” font can be used to show Cyrillic texts. Look at CEGUI example “FontDemo” for more information. Here is what we did:
CEGUI::Font& font(CEGUI::FontManager::getSingleton().createFromFile( "DejaVuSans-10.font" )); CEGUI::System::getSingleton().getDefaultGUIContext().setDefaultFont( &font);
Now, some places in the game we needed a smaller font, so here is what we did then:
CEGUI::Font& textFont = CEGUI::FontManager::getSingleton().createFreeTypeFont("DejaVuSerif-10", 12.f, true, "DejaVuSans.ttf", CEGUI::Font::getDefaultResourceGroup()); CEGUI::DefaultWindow* window = createStaticText(false); window->setFont(&textFont);
Senior Software Engineer developing all kinds of stuff.