1111#include " ft2font.h"
1212#include " mplutils.h"
1313#include " numpy_cpp.h"
14+ #include " py_converters.h"
1415#include " py_exceptions.h"
1516
1617#ifndef M_PI
@@ -184,11 +185,13 @@ FT2Image::draw_rect_filled(unsigned long x0, unsigned long y0, unsigned long x1,
184185 m_dirty = true ;
185186}
186187
187- static void ft_glyph_warn (FT_ULong charcode)
188+ static void ft_glyph_warn (FT_ULong charcode, FT_String * family_name )
188189{
190+ const char * name = (family_name != NULL )?family_name:" UNAVAILABLE" ;
189191 PyObject *text_helpers = NULL , *tmp = NULL ;
192+
190193 if (!(text_helpers = PyImport_ImportModule (" matplotlib._text_helpers" )) ||
191- !(tmp = PyObject_CallMethod (text_helpers, " warn_on_missing_glyph" , " k " , charcode))) {
194+ !(tmp = PyObject_CallMethod (text_helpers, " warn_on_missing_glyph" , " (k, s) " , charcode, name ))){
192195 goto exit;
193196 }
194197exit:
@@ -207,7 +210,7 @@ ft_get_char_index_or_warn(FT_Face face, FT_ULong charcode, bool warn = true)
207210 return glyph_index;
208211 }
209212 if (warn) {
210- ft_glyph_warn (charcode);
213+ ft_glyph_warn (charcode, face-> family_name );
211214 }
212215 return 0 ;
213216}
@@ -515,7 +518,7 @@ void FT2Font::set_text(
515518 char_to_font, glyph_to_font, codepoints[n], flags,
516519 charcode_error, glyph_error, false );
517520 if (!was_found) {
518- ft_glyph_warn ((FT_ULong)codepoints[n]);
521+ ft_glyph_warn ((FT_ULong)codepoints[n], (ft_object_with_glyph-> face )-> family_name );
519522
520523 // render missing glyph tofu
521524 // come back to top-most font
@@ -582,7 +585,7 @@ void FT2Font::load_char(long charcode, FT_Int32 flags, FT2Font *&ft_object, bool
582585 bool was_found = load_char_with_fallback (ft_object_with_glyph, final_glyph_index, glyphs, char_to_font,
583586 glyph_to_font, charcode, flags, charcode_error, glyph_error, true );
584587 if (!was_found) {
585- ft_glyph_warn (charcode);
588+ ft_glyph_warn (charcode, (ft_object_with_glyph-> face )-> family_name );
586589 if (charcode_error) {
587590 throw_ft_error (" Could not load charcode" , charcode_error);
588591 }
0 commit comments