|
From: David K. <dav...@gm...> - 2008-10-22 20:23:35
|
Hello,
I am getting an error with savefig and pdf when I try to used matplotlib
with latex font rendering (attached below). In etc/matplotlibrc, I set
text.latex.preamble : \usepackage{MinionPro},
\renewcommand{\sfdefault}{Myriad-LF}
It seems that the dviread backend does not find a specific *.vf,
MinionPro-It--lcdfj.vf to be specific,
file that is not needed in my opinion. Any ideas how to solve that?
Thanks,
David
------------------------------------------------------------------------------------
Traceback (most recent call
last):
File "niotrode_tipz.py", line 71, in
<module>
p.savefig('niotrode_impedance_plot.pdf')
File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 342, in
savefig
return fig.savefig(*args,
**kwargs)
File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 964, in
savefig
self.canvas.print_figure(*args,
**kwargs)
File
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_qt4agg.py",
line 147, in
print_figure
FigureCanvasAgg.print_figure(self, *args,
**kwargs)
File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line
1310, in print_figure
**kwargs)
File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line
1204, in print_pdf
return pdf.print_pdf(*args,
**kwargs)
File
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py", line
1864, in print_pdf
self.figure.draw(renderer)
File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 759, in
draw
for a in self.axes:
a.draw(renderer)
File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 1523, in
draw
a.draw(renderer)
File "/usr/lib/python2.5/site-packages/matplotlib/axis.py", line 733, in
draw
self.label.draw(renderer)
File "/usr/lib/python2.5/site-packages/matplotlib/text.py", line 299, in
draw
bbox, info =
self._get_layout(renderer)
File "/usr/lib/python2.5/site-packages/matplotlib/text.py", line 199, in
_get_layout
line, self._fontproperties,
ismath=self.is_math_text(line))
File
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_pdf.py", line
1560, in
get_text_width_height_descent
page =
iter(dvi).next()
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 62, in
__iter__
have_page =
self._read()
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 119,
in _read
self._dispatch(byte)
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 207,
in _dispatch
self._fnt_def(k, c, s, d, a, l,
n)
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 368,
in _fnt_def
vf =
_vffile(n[-l:])
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 779,
in _vffile
return _fontfile(texname, Vf, '.vf', _vfcache)
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 768,
in _fontfile
result = class_(filename)
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 437,
in __init__
self._read()
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 119,
in _read
self._dispatch(byte)
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 466,
in _dispatch
Dvi._dispatch(self, byte)
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 207,
in _dispatch
self._fnt_def(k, c, s, d, a, l, n)
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 504,
in _fnt_def
Dvi._fnt_def(self, k, *args)
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 368,
in _fnt_def
vf = _vffile(n[-l:])
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 779,
in _vffile
return _fontfile(texname, Vf, '.vf', _vfcache)
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 768,
in _fontfile
result = class_(filename)
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 437,
in __init__
self._read()
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 119,
in _read
self._dispatch(byte)
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 466,
in _dispatch
Dvi._dispatch(self, byte)
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 207,
in _dispatch
self._fnt_def(k, c, s, d, a, l, n)
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 504,
in _fnt_def
Dvi._fnt_def(self, k, *args)
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 370,
in _fnt_def
self.fonts[k] = DviFont(scale=s, tfm=tfm, texname=n, vf=vf)
File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 398,
in __init__
for char in range(0, max(tfm.width)) ]
ValueError: max() arg is an empty sequence
|
|
From: Jouni K. S. <jk...@ik...> - 2008-10-23 05:05:22
|
"David Krapohl" <dav...@gm...>
writes:
> I am getting an error with savefig and pdf when I try to used matplotlib
> with latex font rendering (attached below). In etc/matplotlibrc, I set
> text.latex.preamble : \usepackage{MinionPro},
> \renewcommand{\sfdefault}{Myriad-LF}
> It seems that the dviread backend does not find a specific *.vf,
> MinionPro-It--lcdfj.vf to be specific,
> file that is not needed in my opinion. Any ideas how to solve that?
Is that a commercial font? What exact files are installed when you
install that font in your texmf tree? Can dvipdfm/dvipdfmx/dvipdft
create a pdf file from a dvi file that uses this font?
>From your backtrace, it looks like dviread fails to parse a tfm file:
> File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line 398,
> in __init__
> for char in range(0, max(tfm.width)) ]
> ValueError: max() arg is an empty sequence
--
Jouni K. Seppänen
http://www.iki.fi/jks
|
|
From: David K. <dav...@gm...> - 2008-10-23 07:22:21
|
On Thu, Oct 23, 2008 at 7:04 AM, Jouni K. Seppänen <jk...@ik...> wrote:
> "David Krapohl" <dav...@gm...>
> writes:
>
> > I am getting an error with savefig and pdf when I try to used matplotlib
> > with latex font rendering (attached below). In etc/matplotlibrc, I set
> > text.latex.preamble : \usepackage{MinionPro},
> > \renewcommand{\sfdefault}{Myriad-LF}
> > It seems that the dviread backend does not find a specific *.vf,
> > MinionPro-It--lcdfj.vf to be specific,
> > file that is not needed in my opinion. Any ideas how to solve that?
>
> Is that a commercial font? What exact files are installed when you
> install that font in your texmf tree? Can dvipdfm/dvipdfmx/dvipdft
> create a pdf file from a dvi file that uses this font?
>
It is an adobe font that is bundled with the Acrobat Reader. It is an otf
font that was converted with "cfftot1" to *.pfb postscript font. Font
metrics and scripts can be downloaded at
http://developer.berlios.de/projects/minionpro/
I use it very often and so far I didn't have problems.
>
> >From your backtrace, it looks like dviread fails to parse a tfm file:
>
> > File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line
> 398,
> > in __init__
> > for char in range(0, max(tfm.width)) ]
> > ValueError: max() arg is an empty sequence
>
Yes, with --verbose-debug-annoying I can see that it stops at:
find_tex_file: MinionPro-It--lcdfj.vf ->
Followed by the same error message as in the first post. Unfortunately the
vf-file is not there but the tfm file. As far as I know does this file
describe the dotless-j for whatever reasons. So I think this particular file
is not very important for math output.
> --
> Jouni K. Seppänen
> http://www.iki.fi/jks
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
David Krapohl |
|
From: Jouni K. S. <jk...@ik...> - 2008-10-23 16:53:04
|
"David Krapohl" <dav...@gm...> writes: >> >From your backtrace, it looks like dviread fails to parse a tfm file: >> >> > File "/usr/lib/python2.5/site-packages/matplotlib/dviread.py", line >> 398, >> > in __init__ >> > for char in range(0, max(tfm.width)) ] >> > ValueError: max() arg is an empty sequence >> > > Yes, with --verbose-debug-annoying I can see that it stops at: > find_tex_file: MinionPro-It--lcdfj.vf -> I was able to reproduce the problem, and have fixed the immediate problem, so you should no longer get an exception with the latest trunk version of matplotlib. However, the output seems to have some encoding problems. I will look into the encoding issue, but cannot promise any particular time frame for a solution. If using the Postscript backend and then converting to pdf is an option for you, it may be a workaround. -- Jouni K. Seppänen http://www.iki.fi/jks |
|
From: Jouni K. S. <jk...@ik...> - 2008-12-29 14:11:53
|
I finally got around to addressing this issue from October:
"David Krapohl" <dav...@gm...> writes:
>> I am getting an error with savefig and pdf when I try to used
>> matplotlib with latex font rendering (attached below). In
>> etc/matplotlibrc, I set text.latex.preamble :
>> \usepackage{MinionPro},
Jouni K. Seppänen <jk...@ik...> writes:
> However, the output seems to have some encoding problems. I will look
> into the encoding issue, but cannot promise any particular time frame
> for a solution.
I think I have fixed the encoding bug in revision 6707. While the only
user-visible change should be that some custom LaTeX fonts now work
(specifically, large fonts such as Minion Pro and MnSymbol that need
several different encodings), the changes in backend_pdf.py were big
enough that I'm hesitant to check this in on the maintenance branch.
--
Jouni K. Seppänen
http://www.iki.fi/jks
|