Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5eaf7e6

Browse files
committed
Fix KeyError: (1, 0, 0, 6) on Windows
1 parent 000bb8b commit 5eaf7e6

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/matplotlib/textpath.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ def _get_char_id(self, font, ccode):
6161
"""
6262
Return a unique id for the given font and character-code set.
6363
"""
64-
ps_name = font.get_sfnt()[(1, 0, 0, 6)]
64+
sfnt = font.get_sfnt()
65+
try:
66+
ps_name = sfnt[(1,0,0,6)]
67+
except KeyError:
68+
ps_name = sfnt[(3,1,0x0409,6)].decode(
69+
'utf-16be').encode('ascii','replace')
6570
char_id = urllib.quote('%s-%x' % (ps_name, ccode))
6671
return char_id
6772

0 commit comments

Comments
 (0)