diff --git a/data/ttf/FreeMonoBold.ttf b/data/ttf/FreeMonoBold.ttf deleted file mode 100644 index 48154499c..000000000 Binary files a/data/ttf/FreeMonoBold.ttf and /dev/null differ diff --git a/data/ttf/LICENSE b/data/ttf/LICENSE index 28c35f3ef..7a3f1619f 100644 --- a/data/ttf/LICENSE +++ b/data/ttf/LICENSE @@ -1,4 +1,4 @@ -GNU FreeFont (FreeSans, FreeSansBold, FreeMono) is released under the GPLv3 +GNU FreeFont (FreeSans, FreeSansBold) is released under the GPLv3 wqyMicroHei is released under the GPLv3 with font embedding exception and Apache-2.0 licenses By Qianqian Fang and The WenQuanYi Project Contributors diff --git a/src/guiengine/ft_environment.cpp b/src/guiengine/ft_environment.cpp index d6dc70e90..89da4a934 100644 --- a/src/guiengine/ft_environment.cpp +++ b/src/guiengine/ft_environment.cpp @@ -68,6 +68,10 @@ void FTEnvironment::loadFont() (FileManager::TTF, "Ubuntu-B.ttf", true)).c_str(), 0, &(FTEnvironment::ft_face[F_BOLD])); + FTEnvironment::ft_err += FT_New_Face(FTEnvironment::ft_lib, (file_manager->getAssetChecked + (FileManager::TTF, "FreeSansBold.ttf", true)).c_str(), + 0, &(FTEnvironment::ft_face[F_BOLD_FALLBACK])); + FTEnvironment::ft_err += FT_New_Face(FTEnvironment::ft_lib, (file_manager->getAssetChecked (FileManager::TTF, "Ubuntu-B.ttf",true)).c_str(), 0, &(FTEnvironment::ft_face[F_DIGIT])); diff --git a/src/guiengine/get_font_properties.hpp b/src/guiengine/get_font_properties.hpp index 417ea1cec..0f5baafb8 100644 --- a/src/guiengine/get_font_properties.hpp +++ b/src/guiengine/get_font_properties.hpp @@ -33,8 +33,9 @@ enum FontUse F_CJK = 2, F_AR = 3, F_BOLD = 4, - F_DIGIT = 5, - F_COUNT = 6 + F_BOLD_FALLBACK = 5, + F_DIGIT = 6, + F_COUNT = 7 }; enum TTFLoadingType {T_NORMAL, T_DIGIT, T_BOLD}; diff --git a/src/guiengine/glyph_page_creator.cpp b/src/guiengine/glyph_page_creator.cpp index eb51a12ef..86f7fcf55 100644 --- a/src/guiengine/glyph_page_creator.cpp +++ b/src/guiengine/glyph_page_creator.cpp @@ -107,10 +107,10 @@ bool GlyphPageCreator::insertGlyph(FT_Bitmap bits, core::rect& rect) const u32 image_pitch = image->getPitch() / sizeof(u32); u32* image_data = (u32*)image->lock(); u8* glyph_data = bits.buffer; - for (u32 y = 0; y < bits.rows; ++y) + for (u32 y = 0; y < (unsigned)bits.rows; ++y) { u8* row = glyph_data; - for (u32 x = 0; x < bits.width; ++x) + for (u32 x = 0; x < (unsigned)bits.width; ++x) { image_data[y * image_pitch + x] |= static_cast(255.0f * (static_cast(*row++) / gray_count)) << 24; //data[y * image_pitch + x] |= ((u32)(*bitsdata++) << 24); diff --git a/src/guiengine/scalable_font.cpp b/src/guiengine/scalable_font.cpp index 13c5f057f..761419251 100644 --- a/src/guiengine/scalable_font.cpp +++ b/src/guiengine/scalable_font.cpp @@ -381,12 +381,6 @@ bool ScalableFont::loadTTF() std::vector advance; std::vector height; - err = FT_Set_Pixel_Sizes(cur_face, 0, m_dpi); - if (err) - Log::error("ScalableFont::loadTTF", "Can't set font size."); - - slot = cur_face->glyph; - std::set::iterator it; s32 current_maxheight = 0; s32 t; @@ -402,8 +396,33 @@ bool ScalableFont::loadTTF() SGUISprite s; core::rect rectangle; - // Retrieve glyph index from character code, skip useless glyph. - int idx = FT_Get_Char_Index(cur_face, *it); + int idx; + if (m_type == T_BOLD) //Lite-Fontconfig for stk, this one is specifically for bold title + { + int count = F_BOLD; + while (count < irr::gui::F_COUNT) + { + m_font_use = (FontUse)count; + err = FT_Set_Pixel_Sizes(cur_face, 0, m_dpi); + if (err) + Log::error("ScalableFont::loadTTF", "Can't set font size."); + + idx = FT_Get_Char_Index(cur_face, *it); + if (idx > 0) break; + count++; + } + } + else + { + err = FT_Set_Pixel_Sizes(cur_face, 0, m_dpi); + if (err) + Log::error("ScalableFont::loadTTF", "Can't set font size."); + + idx = FT_Get_Char_Index(cur_face, *it); + } + + slot = cur_face->glyph; + if (idx) { // Load glyph image into the slot (erase previous one) @@ -599,7 +618,7 @@ bool ScalableFont::lazyLoadChar() //Lite-Fontconfig for stk int idx; int count = 0; - while (count < irr::gui::F_COUNT - 2) //Exclude bold and digit font + while (count < irr::gui::F_COUNT - 3) //Exclude bold with fallback and digit font { m_font_use = (FontUse)count; err = FT_Set_Pixel_Sizes(cur_face, 0, m_dpi);