diff --git a/src/guiengine/get_font_properties.cpp b/src/guiengine/get_font_properties.cpp index 12b1502b2..42989c2a4 100644 --- a/src/guiengine/get_font_properties.cpp +++ b/src/guiengine/get_font_properties.cpp @@ -114,18 +114,23 @@ void getFontProperties::loadNumber(float scale) void getFontProperties::loadBoldChar(float scale) { size = (int)(120*scale); //Set default size for Bold Text - for (int i = 33; i < 256; ++i) + for (int i = 65; i < 640; ++i) usedchar.insert((wchar_t)i); setlocale(LC_ALL, "en_US.UTF8"); std::set::iterator it = usedchar.begin(); while (it != usedchar.end()) { - if (iswlower((wchar_t)*it)) + if (iswlower((wchar_t)*it) || !iswalpha((wchar_t)*it)) it = usedchar.erase(it); else ++it; } + + //Final hack to make stk display title properly + usedchar.insert((wchar_t)33); + usedchar.insert((wchar_t)160); + usedchar.erase((wchar_t)304); } } // end namespace gui diff --git a/src/guiengine/glyph_page_creator.cpp b/src/guiengine/glyph_page_creator.cpp index 3bbef491c..534606bc6 100644 --- a/src/guiengine/glyph_page_creator.cpp +++ b/src/guiengine/glyph_page_creator.cpp @@ -42,6 +42,11 @@ GlyphPageCreator::~GlyphPageCreator() page = 0; } +void GlyphPageCreator::dumpGlyphPage(const core::stringc fn) +{ + GUIEngine::getDriver()->writeImageToFile(page, fn + ".png"); +} + bool GlyphPageCreator::checkEnoughSpace(FT_Bitmap bits) { core::dimension2du d(bits.width + 1, bits.rows + 1); @@ -63,10 +68,8 @@ void GlyphPageCreator::clearGlyphPage() void GlyphPageCreator::createNewGlyphPage() { - video::IImage* blank = GUIEngine::getDriver()->createImage(video::ECF_A8R8G8B8, core::dimension2du(512, 512)); - blank->copyTo(page, core::position2di(0, 0)); - blank->drop(); - blank = 0; + //Clean the current glyph page by filling it with transparent content + page->fill(video::SColor(0, 0,0,0)); } video::IImage* GlyphPageCreator::getPage() diff --git a/src/guiengine/glyph_page_creator.hpp b/src/guiengine/glyph_page_creator.hpp index c0a3e931c..501f82710 100644 --- a/src/guiengine/glyph_page_creator.hpp +++ b/src/guiengine/glyph_page_creator.hpp @@ -31,6 +31,7 @@ public: GlyphPageCreator(); ~GlyphPageCreator(); + static void dumpGlyphPage(const core::stringc); static bool checkEnoughSpace(FT_Bitmap); static void clearGlyphPage(); static void createNewGlyphPage(); diff --git a/src/guiengine/scalable_font.cpp b/src/guiengine/scalable_font.cpp index 9bd01e414..662f4736e 100644 --- a/src/guiengine/scalable_font.cpp +++ b/src/guiengine/scalable_font.cpp @@ -438,6 +438,9 @@ bool ScalableFont::loadTTF() if (!gp_creator->checkEnoughSpace(bits)) // Glyph page is full, save current one and reset the current page { +#ifdef FONT_DEBUG + gp_creator->dumpGlyphPage(((std::to_string(m_type)) + "_" + (std::to_string(texno))).c_str()); +#endif SpriteBank->setTexture(texno, Driver->addTexture("Glyph_page", gp_creator->getPage())); gp_creator->clearGlyphPage(); SpriteBank->addTexture(NULL); @@ -465,6 +468,9 @@ bool ScalableFont::loadTTF() // Check for glyph page which can fit all characters if (it == --cur_prop.usedchar.end()) { +#ifdef FONT_DEBUG + gp_creator->dumpGlyphPage(((std::to_string(m_type)) + "_" + (std::to_string(texno))).c_str()); +#endif SpriteBank->setTexture(texno, Driver->addTexture("Glyph_page", gp_creator->getPage())); gp_creator->clearGlyphPage(); }