Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions lib/matplotlib/backends/backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,10 +1146,10 @@ def embedTTFType42(font, characters, descriptor):
# You are lost in a maze of TrueType tables, all different...
sfnt = font.get_sfnt()
try:
ps_name = sfnt[(1, 0, 0, 6)].decode('macroman') # Macintosh scheme
ps_name = sfnt[1, 0, 0, 6].decode('mac_roman') # Macintosh scheme
except KeyError:
# Microsoft scheme:
ps_name = sfnt[(3, 1, 0x0409, 6)].decode('utf-16be')
ps_name = sfnt[3, 1, 0x0409, 6].decode('utf-16be')
# (see freetype/ttnameid.h)
ps_name = ps_name.encode('ascii', 'replace')
ps_name = Name(ps_name)
Expand Down
5 changes: 2 additions & 3 deletions lib/matplotlib/backends/backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,10 +696,9 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
self.set_color(*gc.get_rgb())
sfnt = font.get_sfnt()
try:
ps_name = sfnt[(1,0,0,6)].decode('macroman')
ps_name = sfnt[1, 0, 0, 6].decode('mac_roman')
except KeyError:
ps_name = sfnt[(3,1,0x0409,6)].decode(
'utf-16be')
ps_name = sfnt[3, 1, 0x0409, 6].decode('utf-16be')
ps_name = ps_name.encode('ascii', 'replace').decode('ascii')
self.set_font(ps_name, prop.get_size_in_points())

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ def _write_svgfonts(self):
font = get_font(font_fname)
font.set_size(72, 72)
sfnt = font.get_sfnt()
writer.start('font', id=sfnt[(1, 0, 0, 4)])
writer.start('font', id=sfnt[1, 0, 0, 4].decode("mac_roman"))
writer.element(
'font-face',
attrib={
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,11 @@ def ttfFontProperty(font):
sfnt2 = sfnt.get((1,0,0,2))
sfnt4 = sfnt.get((1,0,0,4))
if sfnt2:
sfnt2 = sfnt2.decode('macroman').lower()
sfnt2 = sfnt2.decode('mac_roman').lower()
else:
sfnt2 = ''
if sfnt4:
sfnt4 = sfnt4.decode('macroman').lower()
sfnt4 = sfnt4.decode('mac_roman').lower()
else:
sfnt4 = ''
if sfnt4.find('oblique') >= 0:
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/textpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def _get_char_id(self, font, ccode):
"""
sfnt = font.get_sfnt()
try:
ps_name = sfnt[(1, 0, 0, 6)].decode('macroman')
ps_name = sfnt[1, 0, 0, 6].decode('mac_roman')
except KeyError:
ps_name = sfnt[(3, 1, 0x0409, 6)].decode('utf-16be')
ps_name = sfnt[3, 1, 0x0409, 6].decode('utf-16be')
char_id = urllib_quote('%s-%x' % (ps_name, ccode))
return char_id

Expand Down