From 4833962887136ed074aacce39989b578ba6a4691 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 7 May 2019 17:09:09 +0200 Subject: [PATCH] Fix glyph loading in textpath. I missed the fact that `enc` is now a list, not a mapping anymore (and `glyph` is still an index), so the `glyph in enc` check does not make sense anymore. This fixes test_backend_svg::test_unicode_won, which previously failed *if run by itself* but curiously would not fail when run with the rest of the test suite. --- lib/matplotlib/textpath.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/matplotlib/textpath.py b/lib/matplotlib/textpath.py index 8122f24644c5..d170343425be 100644 --- a/lib/matplotlib/textpath.py +++ b/lib/matplotlib/textpath.py @@ -312,18 +312,10 @@ def get_glyphs_tex(self, prop, s, glyph_map=None, font.set_size(self.FONT_SCALE, self.DPI) # See comments in _get_ps_font_and_encoding. if enc is not None: - if glyph not in enc: - _log.warning( - "The glyph %d of font %s cannot be converted with " - "the encoding; glyph may be wrong.", - glyph, font.fname) - font.load_char(glyph, flags=LOAD_TARGET_LIGHT) - else: - index = font.get_name_index(enc[glyph]) - font.load_glyph(index, flags=LOAD_TARGET_LIGHT) + index = font.get_name_index(enc[glyph]) + font.load_glyph(index, flags=LOAD_TARGET_LIGHT) else: - index = glyph - font.load_char(index, flags=LOAD_TARGET_LIGHT) + font.load_char(glyph, flags=LOAD_TARGET_LIGHT) glyph_map_new[char_id] = font.get_path() glyph_ids.append(char_id)