@@ -506,19 +506,23 @@ void FT2Font::set_text(
506
506
FT_UInt previous = 0 ;
507
507
FT2Font *previous_ft_object = NULL ;
508
508
509
+ FT_WarnCache warn_cache;
510
+
509
511
for (size_t n = 0 ; n < N; n++) {
510
512
FT_UInt glyph_index = 0 ;
511
513
FT_BBox glyph_bbox;
512
514
FT_Pos last_advance;
513
515
514
516
FT_Error charcode_error, glyph_error;
515
517
FT2Font *ft_object_with_glyph = this ;
518
+
516
519
bool was_found = load_char_with_fallback (ft_object_with_glyph, glyph_index, glyphs,
517
520
char_to_font, glyph_to_font, codepoints[n], flags,
518
- charcode_error, glyph_error, false );
521
+ charcode_error, glyph_error, false , &warn_cache );
519
522
if (!was_found) {
520
523
// render missing glyph tofu
521
524
// come back to top-most font
525
+ warn_cache.warn ();
522
526
ft_object_with_glyph = this ;
523
527
char_to_font[codepoints[n]] = ft_object_with_glyph;
524
528
glyph_to_font[glyph_index] = ft_object_with_glyph;
@@ -579,9 +583,11 @@ void FT2Font::load_char(long charcode, FT_Int32 flags, FT2Font *&ft_object, bool
579
583
FT_UInt final_glyph_index;
580
584
FT_Error charcode_error, glyph_error;
581
585
FT2Font *ft_object_with_glyph = this ;
586
+ FT_WarnCache warn_cache;
582
587
bool was_found = load_char_with_fallback (ft_object_with_glyph, final_glyph_index, glyphs, char_to_font,
583
- glyph_to_font, charcode, flags, charcode_error, glyph_error, true );
588
+ glyph_to_font, charcode, flags, charcode_error, glyph_error, true , warn_cache );
584
589
if (!was_found) {
590
+ warn_cache.warn ();
585
591
if (charcode_error) {
586
592
throw_ft_error (" Could not load charcode" , charcode_error);
587
593
}
@@ -639,9 +645,11 @@ bool FT2Font::load_char_with_fallback(FT2Font *&ft_object_with_glyph,
639
645
FT_Int32 flags,
640
646
FT_Error &charcode_error,
641
647
FT_Error &glyph_error,
642
- bool override = false )
648
+ bool override = false , std::vector<FT_WarnCache> &warn_cache )
643
649
{
644
- FT_UInt glyph_index = ft_get_char_index_or_warn (face, charcode);
650
+ FT_UInt glyph_index = ft_get_char_index_or_warn (face, charcode, warn=false );
651
+ if (!glyph_index){
652
+ warn_cache.push_back (charcode, face->family_name )};
645
653
if (glyph_index || override ) {
646
654
if (charcode_error=FT_Load_Glyph (face, glyph_index, flags)) {
647
655
return false ;
@@ -834,3 +842,9 @@ long FT2Font::get_name_index(char *name)
834
842
{
835
843
return FT_Get_Name_Index (face, (FT_String *)name);
836
844
}
845
+
846
+ void FT_WarnCache::warn (){
847
+ for (int i=0 ; i<cache.size (); i++){
848
+ ft_glyph_warn (self.cache [i].charcode , self.cache [i].family_name );
849
+ }
850
+ }
0 commit comments