Skip to content

svg backend has limited encoding support with usetex #8068

Closed
@jkseppan

Description

@jkseppan

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 .

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions