Using helvetica latex fonts...

It's a bug. We need to either include the font information

    > in the md5 ().hexdigest, or we need to add font

I just committed a change to include the rc font info in the hash
name. This will obviate the old cache, so feel free to flush it.

Thanks,
JDH

John Hunter wrote:

"Darren" == Darren Dale <dd55@...163...> writes:

    > It's a bug. We need to either include the font information
    > in the md5 ().hexdigest, or we need to add font

I just committed a change to include the rc font info in the hash
name. This will obviate the old cache, so feel free to flush it.

OK, I'm still seeing very funny behavior (current mpl form CVS). Let me try to document things as I go, so you have a record. I have permanently set:

text.usetex : True
text.tex.engine : latex
ps.useafm : False

mp is a macro which does:

In [23]: p mp.value
figure()
plot([1,2,3])
title(r'Hello matplotlib: $x=1+\alpha')

Running it any number of times, all the while changing this:

In [28]: rc('font.latex',package='times')

to 'times', 'helvetica', etc, produces no change in the generated picture. Is this setting supposed to be ignored? I see that

http://www.scipy.org/wikis/topical_software/UsingTex

mentions that these parameters can be changed 'before importing pylab'. Any reason why they can't be reset on the fly?

I can see that it IS possible to get either helvetica or CM. But it seems like I HAVE to make the choice at startup time, in my matplotlibrc file. And it only seems to work by setting If I set:

font.family : serif (or sans-)

AND

blowing away the font-cache on each pylab restart.

Trying to switch back and forth between modes doesn't seem to work unless you blow the cache (even restarting pylab), so something is still broken re. cache handling.

AND, even worse, I'm getting consistently that if I select

font.latex.package : helvetica

produces a nasty error (I can send the full tb if needed):

/usr/lib/python2.3/site-packages/matplotlib/backends/backend_agg.py in get_text_width_height(self, s, prop, ismath, rgb)
     241 size = prop.get_size_in_points()
     242 dpi = self.dpi.get()
--> 243 Z = self.texmanager.get_rgba(s, size, dpi, rgb)
     244 m,n,tmp = Z.shape
     245 return n,m

/usr/lib/python2.3/site-packages/matplotlib/texmanager.py in get_rgba(self, tex, fontsize, dpi, rgb)
     310 # force=True to skip cacheing while debugging
     311 pngfile = self.make_png(tex, dpi, force=False)
--> 312 X = readpng(pngfile)
     313 vers = self.get_dvipng_version()
     314 #print 'dvipng version', vers

RuntimeError: _image_module::readpng could not open PNG file /home/fperez/.matplotlib/tex.cache/4c6661ae3b1f9211424cf72e05973891_120.png for reading

So the latex.package part seems broken.

Cheers,

f

ps - John, you really should, in the users_guide.tex,

\usepackage{hyperref}

so the PDF has internal links. This makes a big convenience difference for the use of the table of contents. The fancy form (intended for compilation with pdflatex, NOT latex), [this is from common_preamble.tex in the p20 doc]:

% This gives us a better font in URL links (otherwise the default
% MonoSpace font is bitmapped, and it looks horrible in PDF)
\usepackage{courier}

\usepackage{color}

% The hyperref package gives us a pdf with properly built
% internal navigation ('pdf bookmarks' for the table of contents,
% internal cross-reference links, web links for URLs, etc.)

% A few colors to replace the defaults for certain link types
\definecolor{darkorange}{rgb}{.71,0.21,0.01}
\definecolor{darkgreen}{rgb}{.12,.54,.11}

\usepackage[pdftex, % needed for pdflatex
   breaklinks=true, % so long urls are correctly broken across lines
   colorlinks=true,
   urlcolor=blue,
   linkcolor=darkorange,
   citecolor=darkgreen,
   ]{hyperref}

% This helps prevent overly long lines that stretch beyond the margins
\sloppy

AND, even worse, I'm getting consistently that if I select

font.latex.package : helvetica

produces a nasty error (I can send the full tb if needed):

[...]

RuntimeError: _image_module::readpng could not open PNG file
/home/fperez/.matplotlib/tex.cache/4c6661ae3b1f9211424cf72e05973891_120.png
for reading

Oh, helvetica is not a valid package, so latex fails and dvipng is unable to
produce the png file. I think you are looking for the "helvet" package. I
should go through texmf/tex/latex/ and make a list of all the valid font
packages for latex, and include the list in the rc file.

Darren

···

On Saturday 21 January 2006 7:14 pm, Fernando Perez wrote:

Darren Dale wrote:

···

On Saturday 21 January 2006 7:14 pm, Fernando Perez wrote:

AND, even worse, I'm getting consistently that if I select

font.latex.package : helvetica

produces a nasty error (I can send the full tb if needed):

[...]

RuntimeError: _image_module::readpng could not open PNG file
/home/fperez/.matplotlib/tex.cache/4c6661ae3b1f9211424cf72e05973891_120.png
for reading

Oh, helvetica is not a valid package, so latex fails and dvipng is unable to produce the png file. I think you are looking for the "helvet" package. I should go through texmf/tex/latex/ and make a list of all the valid font packages for latex, and include the list in the rc file.

Ah, sorry, my fault then! Yes, listing the correct latex font package names in the rc file would be good, I was going on memory and typed the wrong one.

Many thanks for your efforts on this problem: I won't be able to look at this today, but I will again soon.

Regards,

f