@@ -2773,6 +2773,9 @@ static bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
2773
2773
dst_tmp_array.resize (atlas->Fonts .Size );
2774
2774
memset (src_tmp_array.Data , 0 , (size_t )src_tmp_array.size_in_bytes ());
2775
2775
memset (dst_tmp_array.Data , 0 , (size_t )dst_tmp_array.size_in_bytes ());
2776
+ ImVector<bool > src_tmp_array_skip;
2777
+ src_tmp_array_skip.resize (atlas->ConfigData .Size );
2778
+ memset (src_tmp_array_skip.Data , 0 , (size_t )src_tmp_array_skip.size_in_bytes ());
2776
2779
2777
2780
// 1. Initialize font loading structure, check font data validity
2778
2781
for (int src_i = 0 ; src_i < atlas->ConfigData .Size ; src_i++)
@@ -2797,7 +2800,8 @@ static bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
2797
2800
if (!stbtt_InitFont (&src_tmp.FontInfo , (unsigned char *)cfg.FontData , font_offset))
2798
2801
{
2799
2802
IM_ASSERT (0 && " stbtt_InitFont(): failed to parse FontData. It is correct and complete? Check FontDataSize." );
2800
- return false ;
2803
+ src_tmp_array_skip[src_i] = true ;
2804
+ continue ;
2801
2805
}
2802
2806
2803
2807
// Measure highest codepoints
@@ -2818,6 +2822,8 @@ static bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
2818
2822
int total_glyphs_count = 0 ;
2819
2823
for (int src_i = 0 ; src_i < src_tmp_array.Size ; src_i++)
2820
2824
{
2825
+ if (src_tmp_array_skip[src_i])
2826
+ continue ;
2821
2827
ImFontBuildSrcData& src_tmp = src_tmp_array[src_i];
2822
2828
ImFontBuildDstData& dst_tmp = dst_tmp_array[src_tmp.DstIndex ];
2823
2829
src_tmp.GlyphsSet .Create (src_tmp.GlyphsHighest + 1 );
@@ -2844,6 +2850,8 @@ static bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
2844
2850
// 3. Unpack our bit map into a flat list (we now have all the Unicode points that we know are requested _and_ available _and_ not overlapping another)
2845
2851
for (int src_i = 0 ; src_i < src_tmp_array.Size ; src_i++)
2846
2852
{
2853
+ if (src_tmp_array_skip[src_i])
2854
+ continue ;
2847
2855
ImFontBuildSrcData& src_tmp = src_tmp_array[src_i];
2848
2856
src_tmp.GlyphsList .reserve (src_tmp.GlyphsCount );
2849
2857
UnpackBitVectorToFlatIndexList (&src_tmp.GlyphsSet , &src_tmp.GlyphsList );
@@ -2974,6 +2982,8 @@ static bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
2974
2982
// 9. Setup ImFont and glyphs for runtime
2975
2983
for (int src_i = 0 ; src_i < src_tmp_array.Size ; src_i++)
2976
2984
{
2985
+ if (src_tmp_array_skip[src_i])
2986
+ continue ;
2977
2987
// When merging fonts with MergeMode=true:
2978
2988
// - We can have multiple input fonts writing into a same destination font.
2979
2989
// - dst_font->ConfigData is != from cfg which is our source configuration.
0 commit comments