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
Fix including Type 42 fonts in PDF on Python 3.x
  • Loading branch information
mdboom committed May 6, 2013
commit 138d959060a4cc0c6d6f4a7eaebbf52e7c33b6bb
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ def embedTTFType42(font, characters, descriptor):
" ".join(["<%04x>" % x for x in range(start, end+1)])))
unicode_cmap = (self._identityToUnicodeCMap %
(len(unicode_groups),
"\n".join(unicode_bfrange)))
"\n".join(unicode_bfrange))).encode('ascii')

# CIDToGIDMap stream
cid_to_gid_map = "".join(cid_to_gid_map).encode("utf-16be")
Expand Down
12 changes: 12 additions & 0 deletions lib/matplotlib/tests/test_backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,15 @@ def test_use14corefonts():
plt.title(title)
plt.text(0.5, 0.5, text, horizontalalignment='center', fontsize=24)
plt.axhline(0.5, linewidth=0.5)


def test_type42():
import io

rcParams['backend'] = 'pdf'
rcParams['pdf.fonttype'] = 42

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot([1,2,3])
fig.savefig(io.BytesIO())