Skip to content

FIX: fix bad string handling in type1font #4472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps there's no alternative, but I think all those tex packages are huge and will slow down the builds. The existing lines below indicate that the penalty might be reduced by using --no-install-recommends.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that --no-install-recommends for building the documentation. As I remember it it saved a few 100 MB download. In any case this is only relevant on the colour overhaul branch. On master we are using a container build which handles this different.

# 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
Expand Down
Binary file not shown.
10 changes: 10 additions & 0 deletions lib/matplotlib/tests/test_backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intend to leave this comment here? It's baffling.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a typo from modifying the bug report example to be a test, should have been removed.

rcParams['font.serif'] = "Times, serif"
rcParams['text.usetex'] = "true"
fig, ax = plt.subplots()
ax.set_xlabel("$\gamma$")
3 changes: 2 additions & 1 deletion lib/matplotlib/type1font.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down