Thanks to visit codestin.com
Credit goes to github.com

Skip to content

svg backend has limited encoding support with usetex #8068

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
jkseppan opened this issue Feb 12, 2017 · 5 comments · May be fixed by #14159
Closed

svg backend has limited encoding support with usetex #8068

jkseppan opened this issue Feb 12, 2017 · 5 comments · May be fixed by #14159
Labels
backend: svg Difficulty: Hard https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues topic: text/unicode topic: text/usetex
Milestone

Comments

@jkseppan
Copy link
Member

jkseppan commented Feb 12, 2017

Bug report

Bug summary

As reported on Launchpad, the combination of text.usetex=True, text.latex.unicode=True, and the svg backend can produce files with missing or wrong characters. A warning does get printed.

Code for reproduction

from pylab import *
pp={'text.usetex': True, 'text.latex.unicode': True}
rcParams.update(pp)

plot(1,1)
ylabel(r'\textwon')
savefig('tmp.pdf')
savefig('tmp.png')
savefig('tmp.svg')

Actual outcome

The svg file lacks the won character. A warning like the following is printed:

../lib/matplotlib/textpath.py:389: UserWarning: The glyph (142) of font (/usr/local/texlive/2016/texmf-dist/fonts/type1/public/cm-super/sfss3583.pfb) cannot be converted with the encoding. Glyph may be wrong
  "be wrong" % (glyph, font_bunch.filename))

Expected outcome

The svg file should include the won character (₩), as the pdf and png files do. I don't think we document usetex as being supported in the svg backend, but for several use cases it works.

Matplotlib version

Current master (3d99e43) installed from git with pip install -e .

@tacaswell tacaswell added this to the 2.2 (next next feature release) milestone Feb 12, 2017
@tacaswell tacaswell added the Difficulty: Hard https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues label Feb 12, 2017
@tacaswell
Copy link
Member

Labeling this as hard as fixing it will likely involve understanding a whole lot about text encoding.

@slochower
Copy link

I believe I'm also experiencing this issue. In my case, I'm completely missing "fl" from a word in the SVG. I suspect this "fl" is a ligature in LaTeX and thus, possibly, treated as a special character (like the original report). In the generated SVG file, I can see

    <g id="text_26">
     <!-- Directional flux (cycle s$^{{-1}}$) -->
     <defs>

which is correct.

Using matplotlib version 2.1.2 installed via conda, with the following settings:

    mpl.rc('text', usetex=True)
    mpl.rcParams['text.latex.preamble'] = [
        r'\usepackage{amsmath}',
        r'\usepackage{helvet}',
        r'\usepackage[EULERGREEK]{sansmath}',
        r'\sansmath',
        r'\renewcommand{\familydefault}{\sfdefault}',
        r'\usepackage[T1]{fontenc}',
        r'\usepackage{graphicx}'
    ]

text8219-2

@anntzer anntzer mentioned this issue Dec 3, 2018
6 tasks
@github-actions
Copy link

github-actions bot commented Apr 7, 2023

This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Apr 7, 2023
@QuLogic
Copy link
Member

QuLogic commented Apr 7, 2023

This was fixed by #12928 + #14156.

@QuLogic QuLogic closed this as completed Apr 7, 2023
@QuLogic QuLogic modified the milestones: future releases, v3.1.0 Apr 7, 2023
@slochower
Copy link

Thanks for the update @QuLogic

@QuLogic QuLogic removed the status: inactive Marked by the “Stale” Github Action label Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: svg Difficulty: Hard https://matplotlib.org/devdocs/devel/contribute.html#good-first-issues topic: text/unicode topic: text/usetex
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants