Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
anntzer committed May 7, 2019
commit 4833962887136ed074aacce39989b578ba6a4691
14 changes: 3 additions & 11 deletions lib/matplotlib/textpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down