11
11
#include " ft2font.h"
12
12
#include " mplutils.h"
13
13
#include " numpy_cpp.h"
14
+ #include " py_converters.h"
14
15
#include " py_exceptions.h"
15
16
16
17
#ifndef M_PI
@@ -184,11 +185,13 @@ FT2Image::draw_rect_filled(unsigned long x0, unsigned long y0, unsigned long x1,
184
185
m_dirty = true ;
185
186
}
186
187
187
- static void ft_glyph_warn (FT_ULong charcode)
188
+ static void ft_glyph_warn (FT_ULong charcode, FT_String * family_name )
188
189
{
190
+ const char * name = (family_name != NULL )?family_name:" UNAVAILABLE" ;
189
191
PyObject *text_helpers = NULL , *tmp = NULL ;
192
+
190
193
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 ))){
192
195
goto exit ;
193
196
}
194
197
exit :
@@ -207,7 +210,7 @@ ft_get_char_index_or_warn(FT_Face face, FT_ULong charcode, bool warn = true)
207
210
return glyph_index;
208
211
}
209
212
if (warn) {
210
- ft_glyph_warn (charcode);
213
+ ft_glyph_warn (charcode, face-> family_name );
211
214
}
212
215
return 0 ;
213
216
}
@@ -515,7 +518,7 @@ void FT2Font::set_text(
515
518
char_to_font, glyph_to_font, codepoints[n], flags,
516
519
charcode_error, glyph_error, false );
517
520
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 );
519
522
520
523
// render missing glyph tofu
521
524
// come back to top-most font
@@ -582,7 +585,7 @@ void FT2Font::load_char(long charcode, FT_Int32 flags, FT2Font *&ft_object, bool
582
585
bool was_found = load_char_with_fallback (ft_object_with_glyph, final_glyph_index, glyphs, char_to_font,
583
586
glyph_to_font, charcode, flags, charcode_error, glyph_error, true );
584
587
if (!was_found) {
585
- ft_glyph_warn (charcode);
588
+ ft_glyph_warn (charcode, (ft_object_with_glyph-> face )-> family_name );
586
589
if (charcode_error) {
587
590
throw_ft_error (" Could not load charcode" , charcode_error);
588
591
}
0 commit comments