-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Missing character upon savefig() with Free Serif font #17197
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
Comments
fwiw I cannot repro this locally: out.pdf |
I can reproduce on Fedora 30; maybe the font was old? |
Or not, because the font hasn't been touched in ages. TTF vs OTF, maybe? |
Arch provides an otf file (and I was using mpl's pdf backend, not mplcairo). |
Also with LibreOffice Draw it shows correctly. Could it be a problem of the pdf viewer and not at all of Matplotlib? |
Can either of you post the failing file? I would suggest using figtext() instead of text to not include axes, so that there's as little text as possible in the pdf to simplify the troubleshooting. |
Here is the output of the code below: fig.pdf import matplotlib.pyplot as plt
fig = plt.figure(figsize=(2,2))
fig.text(s='(Some text)', x=0.5, y=0.5, fontname='freeserif')
fig.savefig('fig.pdf') |
ok, I can repro now. |
I think you're right. When converting the ttf file to ttx format with fonttools, the parenleft program is <TTGlyph name="parenleft" xMin="48" yMin="-177" xMax="304" yMax="676">
<contour>
<pt x="292" y="-177" on="1"/>
<pt x="266" y="-161" on="0"/>
...
<pt x="304" y="-161" on="1"/>
</contour>
<instructions/>
</TTGlyph> and the parenright program is <TTGlyph name="parenright" xMin="29" yMin="-177" xMax="285" yMax="676">
<component glyphName="parenleft" x="333" y="499" scale="-1.0" flags="0x1004"/>
</TTGlyph> The corresponding charprocs in the pdf file are parenleft: 333 0 48 -176 304 676 d1
292 -176 m
274 -165 256 -152 238 -137 c
...
292 -176 l
f and parenright: 333 0 29 -176 285 676 d1
q 1 0 0 1 333 499 cm
292 -176 m
274 -165 256 -152 238 -137 c
...
292 -176 l
f
Q The only differences in the charproc outputs are in the |
I think the linked #18081 should fix this. If anyone with a good collection of ttf fonts and an eye for detail is interested in testing that, please do. |
Bug report
Bug summary
Choosing the font "Free Serif".
Right parenthesis character ")" is not printed upon using fig.savefig().
It is correctly printed upon using plt.show().
Code for reproduction
Actual outcome
Right parenthesis is not printed on pdf.
Expected outcome
All characters should be printed on pdf.
Matplotlib version
The text was updated successfully, but these errors were encountered: