Skip to content
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

PDF renderer draws strange artifacts on '%' character in 1.1.1 #1211

Closed
eeaston opened this issue Sep 7, 2012 · 15 comments · Fixed by #1222
Closed

PDF renderer draws strange artifacts on '%' character in 1.1.1 #1211

eeaston opened this issue Sep 7, 2012 · 15 comments · Fixed by #1222
Assignees
Milestone

Comments

@eeaston
Copy link

eeaston commented Sep 7, 2012

Hi there,
The following code:

from matplotlib import use
use("pdf")
import matplotlib.pyplot as plt
plt.title("Is there a bug?%%")
plt.savefig("test.pdf")
plt.close

..produces a PDF with strange arrow artiacts overlaying the '%' characters.

This i a regression since 1.1.0.

Matplotlib version: 1.1.1
Backend: PDF
Arch: x86_64
Python: 2.6.2

Thanks,
Edward

@WeatherGod
Copy link
Member

Confirmed in both v1.1.x and master. I suspect it has to do with closing the path incorrectly, but that is just wild speculation on my part.

@pelson
Copy link
Member

pelson commented Sep 7, 2012

@WeatherGod : I've moved this into the "1.2 known bugs" pile. Its one of those things which we would really love to get fixed for 1.2, but if we don't, we don't (at which point, it becomes a known bug). If somebody comes up with a solution to this before we take the rc1 1.2 cut though (or potentially even after?!?), then we are likely to integrate it as a matter of priority. How does that sound?

@WeatherGod
Copy link
Member

fine with me

@eeaston
Copy link
Author

eeaston commented Sep 7, 2012

What's the date for the 1.2 cut? I've got a bit of time right now to dig through it.

@pelson
Copy link
Member

pelson commented Sep 7, 2012

There is a calendar in the wiki: https://github.com/matplotlib/matplotlib/wiki
The date is set for the 17th. As for when we physically take the new 1.2.x branch I am not sure: I assume sometime before that.

If your happy to have a look into this, that would be fantastic! Just in case you have some difficulties, I believe the original author of the pdf backend was @jkseppan (correct me if I am mistaken), who should probably have some visibility of this issue anyway.

Thanks,

@jkseppan
Copy link
Member

jkseppan commented Sep 7, 2012

Thanks for the heads-up - I'll take a look today.

@jkseppan
Copy link
Member

jkseppan commented Sep 7, 2012

If @eeaston or somebody is looking at this now, my first suggestion would be to look at the the recent changes to src/_ttconv.cpp - I rewrote a bit there to fix a rendering problem with one font (I think zeros and eights looked odd), but perhaps the change breaks rendering of the % sign in this font. If you do find a way to fix this, please add a test case where a percent sign is rendered at large scale, so we can ensure that the regression doesn't occur again.

@eeaston
Copy link
Author

eeaston commented Sep 7, 2012

Apologies if I'm missing something, there's been no changes to src/_ttconv.cpp since 1.1.0?

@jkseppan
Copy link
Member

jkseppan commented Sep 7, 2012

Oops, sorry, I was thinking about the ttconv subdirectory, not src/_ttconv.

@eeaston
Copy link
Author

eeaston commented Sep 7, 2012

Hi there - I can confirm that the file that is causing this bug is indeed ttconv/pprdrv_tt2.cpp. As I'm not really a C++ dev however I don't rate my ability to actually fix this in any sane fashion, sorry!

@jenshnielsen
Copy link
Member

I bisected the issue and the bug is introduced in dbc6ef2

@jkseppan
Copy link
Member

I'm moving this to the 1.2 milestone, since it seems to me that #1222 is close to a solution (it still needs more testing).

@mdboom
Copy link
Member

mdboom commented Sep 10, 2012

This seems fine. The original code is not mine -- I merely converted it from a console application into a library and wrapped it for Python. I didn't notice at the time that it was doing all this extra work. Seems reasonable to cut it.

This doesn't seem to regress issue #905, which is great. I'm going to go ahead and merge.

Thanks!

@mdboom mdboom closed this as completed Sep 10, 2012
@havarnov
Copy link

havarnov commented Nov 1, 2012

Work-around: use latex rendering instead.

@shauvik
Copy link

shauvik commented Jan 22, 2015

mpl.rcParams['pdf.fonttype']=42 fixed it for me

From: http://stackoverflow.com/questions/14295647/why-do-vector-based-image-files-contain-damaged-characters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants