Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Summary
In#26989 I could remove the lines warning that a glyph was missing without breaking any tests:
Lines 582 to 585 in112a225
bool was_found =load_char_with_fallback(ft_object_with_glyph, final_glyph_index, glyphs, char_to_font, | |
glyph_to_font, charcode, flags, charcode_error, glyph_error,true); | |
if (!was_found) { | |
ft_glyph_warn(charcode); |
Lines 594 to 596 in112a225
}else { | |
ft_object =this; | |
FT_UInt glyph_index =ft_get_char_index_or_warn(face, (FT_ULong)charcode); |
I didn't remove the warnings cause I don't think we test whatFt2Font.load_char does when given a missing glyph. It's used in three places in the library:
- mathtext:
matplotlib/lib/matplotlib/_mathtext.py
Lines 329 to 333 in978b402
classTruetypeFonts(Fonts,metaclass=abc.ABCMeta): """ A generic base class for all font setups that use Truetype fonts (through FT2Font). """ - textpath:
matplotlib/lib/matplotlib/textpath.py
Lines 163 to 167 in978b402
defget_glyphs_mathtext(self,prop,s,glyph_map=None, return_new_glyphs_only=False): """ Parse mathtext string *s* and convert it to a (vertices, codes) pair. """ - backend_pdf:
matplotlib/lib/matplotlib/backends/backend_pdf.py
Lines 661 to 664 in978b402
classPdfFile: """PDF file object.""" def__init__(self,filename,metadata=None):
Proposed fix
Minimally, there should be at least two tests of howload_char
/the methods calling it handle missing glyphs - mathtext may be a good start. There should be one test for each codepath that triggers a missing glyph error. It would probably also be good to add some more tests for TextPath -> it mostly seems to be tested via gallery examples.