瀏覽代碼

imgui_freetype: skip missing glyphs as well to match our stb loader (#1671, #1703)

omar 7 年之前
父節點
當前提交
35e74c72ab
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      misc/freetype/imgui_freetype.cpp

+ 2 - 0
misc/freetype/imgui_freetype.cpp

@@ -182,6 +182,8 @@ namespace
     bool FreeTypeFont::CalcGlyphInfo(uint32_t codepoint, GlyphInfo &glyph_info, FT_Glyph& ft_glyph, FT_BitmapGlyph& ft_bitmap)
     bool FreeTypeFont::CalcGlyphInfo(uint32_t codepoint, GlyphInfo &glyph_info, FT_Glyph& ft_glyph, FT_BitmapGlyph& ft_bitmap)
     {
     {
         uint32_t glyph_index = FT_Get_Char_Index(FreetypeFace, codepoint);
         uint32_t glyph_index = FT_Get_Char_Index(FreetypeFace, codepoint);
+        if (glyph_index == 0)
+            return false;
         FT_Error error = FT_Load_Glyph(FreetypeFace, glyph_index, FreetypeLoadFlags);
         FT_Error error = FT_Load_Glyph(FreetypeFace, glyph_index, FreetypeLoadFlags);
         if (error)
         if (error)
             return false;
             return false;