Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Properly warn when glyph is not in encoding.
  • Loading branch information
anntzer committed Apr 2, 2019
commit 722de6f75bb1ed72f689055bf7d17cf3c37873ea
11 changes: 9 additions & 2 deletions lib/matplotlib/textpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,15 @@ 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:
index = font.get_name_index(enc[glyph])
font.load_glyph(index, flags=LOAD_TARGET_LIGHT)
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)
else:
index = glyph
font.load_char(index, flags=LOAD_TARGET_LIGHT)
Expand Down