Michael Droettboom <mdroe@...83...> writes:
The font lookup mechanism has been much improved in 0.91.2 -- you may
want to try using that. In 0.90.x, often if you don't get a perfectly
exact match for a font, it reverts back to the default "Vera Sans".
Vera Sans, however, is not a fixed-width font. Can you provide the png
file of fonts_demo.py so I can be sure of what is happening? One way to
diagnose this is to dorc("verbose", level="debug-annoying")
which will print out a bunch of stuff related to font lookup. Attach
the output here and I'll have a look at it to try to figure out what may
be going wrong.Cheers,
MikePaul Smith wrote:
> Hi all,
>
> I've been trying in vain to get a better font on a plot than the fixed
width
> serif one that always appears. I've got lib-freetype6 installed (on Ubuntu
> server), and ran fc-cache after. The .matplotlib/ttfont.cache contains
entries
> for the Free* fonts. The fonts themselves are
> in /usr/share/fonts/truetype/freefont. The sample code below would seem
(to
> me) to have used FreeSans, but the png has the same bad looking fixed-
serif
> font.
> When running the matplotlib examples/fonts_demo.py the result is the same
font
> all over that .png figure too (difference only in sizes).
>
> I usually work on XP, and it all works fine there. Does using only Agg as
the
> backend make any difference whatsoever?
>
> Paul
>
> ubuntu 7.10
> python 2.5
> matplotlib 0.90.1
>
> ----
> Some sample code;
>
> import matplotlib
> from matplotlib import rc
> rc('font',**{'family':'sans-serif','sans-serif':['Arial','FreeSans']})
> matplotlib.use('Agg')
> from pylab import *
>
> plot(arange(100))
> ax=gca()
> ax.set(xlabel='Useless',ylabel='Pointless')
> draw()
> show()
> savefig('test')
> l=ax.xaxis.get_label()
> print 'font prop: ',l.get_font_properties()
> print 'font name: ',l.get_fontname()
>
> ----
> Produces this output;
>
> font prop:
(['Arial', 'FreeSans'], 'normal', 'normal', 'normal', 'normal', 12)
> font name: FreeSans
Hi Michael,
I put in the rc line you suggested below into fonts_demo.py but didn't see it
print any extra info (but did confirm in ipython that rcParams showed
verbose.level had changed to "annoying"). It just quietly finished otherwise.
Did I miss something here?
I've linked the output of fonts_demo.py to;
https://www.box.net/shared/static/o693hq3soo.png
If I need to upgrade matplotlib above 0.90.1 I guess I'll have to build it
separately unfortunately. We're trying to stick to the standard ubuntu
packages that get pulled in for that release.
Thanks for your help,
Paul