diff --git a/.travis.yml b/.travis.yml index cfdade2efbac..7ba1b6cf3808 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ matrix: install: - pip install -q --use-mirrors nose python-dateutil $NUMPY pep8==1.5.7 pyparsing pillow - - sudo apt-get update && sudo apt-get -qq install inkscape libav-tools mencoder + - sudo apt-get update && sudo apt-get -qq install inkscape libav-tools mencoder dvipng texlive-latex-base texlive-latex-extra texlive-fonts-recommended # We use --no-install-recommends to avoid pulling in additional large latex docs that we don't need - if [[ $BUILD_DOCS == true ]]; then sudo apt-get install -qq --no-install-recommends dvipng texlive-latex-base texlive-latex-extra texlive-fonts-recommended graphviz; fi - if [[ $BUILD_DOCS == true ]]; then pip install sphinx numpydoc linkchecker; fi diff --git a/lib/matplotlib/tests/baseline_images/test_backend_pdf/test_type1font_encoding.pdf b/lib/matplotlib/tests/baseline_images/test_backend_pdf/test_type1font_encoding.pdf new file mode 100644 index 000000000000..87fa296cddca Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_backend_pdf/test_type1font_encoding.pdf differ diff --git a/lib/matplotlib/tests/test_backend_pdf.py b/lib/matplotlib/tests/test_backend_pdf.py index 0e693402ca16..d77536aa0d01 100644 --- a/lib/matplotlib/tests/test_backend_pdf.py +++ b/lib/matplotlib/tests/test_backend_pdf.py @@ -87,3 +87,13 @@ def test_multipage_keep_empty(): pdf.savefig() assert os.path.exists(filename) os.remove(filename) + + +@image_comparison(baseline_images=['test_type1font_encoding'], + extensions=['pdf']) +def test_type1font_encoding(): + # This doesn't work + rcParams['font.serif'] = "Times, serif" + rcParams['text.usetex'] = "true" + fig, ax = plt.subplots() + ax.set_xlabel("$\gamma$") diff --git a/lib/matplotlib/type1font.py b/lib/matplotlib/type1font.py index ba457e840959..5de9d265133c 100644 --- a/lib/matplotlib/type1font.py +++ b/lib/matplotlib/type1font.py @@ -333,7 +333,8 @@ def transform(self, effects): extend=effects.get('extend', 1.0)): if six.PY3 and isinstance(value, int): value = chr(value) - value = value.encode('latin-1') + if isinstance(value, six.text_type): + value = value.encode('latin-1') buffer.write(value) result = buffer.getvalue() finally: