Skip to content

Commit

Permalink
Merge pull request #1978 from mdboom/type42-python3
Browse files Browse the repository at this point in the history
Setting font type using rcParams does not work under Python 3.*
  • Loading branch information
mdboom committed May 6, 2013
2 parents 1909fef + 138d959 commit 0c3768e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_pdf.py
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
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())

0 comments on commit 0c3768e

Please sign in to comment.