There are at least a couple of fishy things here.  It doesn't seem to 
find the Vera fonts that matplotlib installs in mpl-data.  Did you 
remove them, or perhaps the Ubuntu or Debian packagers removed them?  
Then at least the default font would be correct (and not cmr10.ttf, 
which is a very bad choice since it uses a TeX encoding).

As for why it is not picking up FreeSans like you request, my best guess 
is that the default properties to not align correctly with it.  This is 
a major shortcoming of the font looking mechanism in 0.90 that was 
addressed in 0.91.  There is a possible workaround that is somewhat 
painful.  If you run the following command in a shell, you should see 
all of the details about the given font:

 > fc-match -v FreeSans
Pattern has 27 elts (size 32)
        family: "Bitstream Vera Sans"(s)
        familylang: "en"(s)
        style: "Roman"(s)
        stylelang: "en"(s)
        slant: 0(i)(s)
        weight: 80(i)(s)
        width: 100(i)(s)
        size: 12(f)(s)
        pixelsize: 12.5(f)(s)
        foundry: "bitstream"(s)
        hintstyle: 1(i)(w)
        hinting: FcTrue(w)
        verticallayout: FcFalse(s)
        autohint: FcFalse(s)
        globaladvance: FcTrue(s)
        file: "/home/mdroe/.fonts/Vera.ttf"(s)

    etc...

(I don't have FreeSans, so the above is for the next best match on my 
machine, Vera Sans).

Now, if you specify the font as specifically as possible, you may get it 
to grab your font:

rc('font',**{'family':'sans-serif','sans-serif':['FreeSans'],'weight':80, 
'style':'Roman'})


(The above will need to be replaced with values for FreeSans, of course).

Let me know if that helps.

Cheers,
Mike

Paul Smith wrote:
> Michael Droettboom <[EMAIL PROTECTED]> writes:
>
>   
>> Paul Smith wrote:
>>     
>>> 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? 
>>>   
>>>       
>> Does it work if you put this into your matplotlibrc?
>>
>>   verbose.level: debug-annoying
>>
>> (Note it's debug-annoying, not simply annoying)
>>     
>>> I've linked the output of fonts_demo.py to;
>>> https://www.box.net/shared/static/o693hq3soo.png
>>>   
>>>       
>> Hmm.  That font is definitely not Vera Sans.  Something really odd is 
>> going on here.
>> I can appreciate that goal -- and AFAIK it does work for other users on 
>>     
> Ubuntu 7.10 so there is probably just
>   
>> some configuration problem here that we can hopefully get to the bottom of.
>>
>> Do you have any customizations in your matplotlibrc?
>>
>> Cheers,
>> Mike
>>
>>     
>
>
> Mike,
>
> I've not made any other changes to matplotlibrc. In fact I only just now have 
> copied the one in /etc to my $HOME/.matplotlib directory. It still seemed to 
> pick up the /etc version as you'll see below, I guess coz I was sudo'd as 
> root? :) anyway...
> Interesting the font search path seems to only include mpl-data fonts, but it 
> does seem to know about the ones in /usr/share/fonts/truetype/freefont. Then 
> fails to use one, so we're always back to cmr10. The output below was for my 
> test plot but it's pretty much the same (longer) story for fonts_demo.py  I 
> tried copying all the freetype fonts into mpl-data/font and everything came 
> out FreeSansOblique. Still failed to find the correct font, but used 
> something 
> a little closer. What do you make of it?
> I'll be away for a while but I'll check the list if I can.
>
> Cheers,
> Paul
>
> debug-annoying dump from my test plot program
> ----------------------------------------
> loaded rc file /etc/matplotlibrc
> matplotlib version 0.90.1
> verbose.level debug-annoying
> interactive is False
> units is True
> platform is linux2
> loaded modules: 
> ['_bisect', 'distutils', 'random', 'datetime', 'matplotlib.tempfile', 
> 'distutil
> s.sysconfig', 'encodings.encodings', 'pytz.cStringIO', 'struct', 'tempfile', 
> 'p
> ytz.os', 'zipimport', 'string', 'encodings.utf_8', 'matplotlib.__future__', 
> 'py
> tz.tzinfo', 'pytz.datetime', 'distutils.re', 'bisect', 'signal', 
> 'matplotlib.py
> tz', 'pytz.tzfile', 'cStringIO', 'locale', 'encodings', 'dateutil', 
> 'matplotlib
> .warnings', 'pytz.pytz', 'matplotlib.sys', 're', 'math', 'fcntl', 'UserDict', 
> '
> distutils.os', 'matplotlib', 'codecs', 'md5', '_locale', 'matplotlib.os', 
> 'thre
> ad', 'itertools', 'distutils.sys', 'os', '__future__', '_sre', '__builtin__', 
> '
> matplotlib.re', 'operator', 'distutils.string', 'matplotlib.datetime', 
> 'posixpa
> th', 'errno', 'binascii', 'sre_constants', 'matplotlib.md5', 'types', 
> 'pytz.sys
> ', '_codecs', 'pytz', 'copy', '_struct', '_types', 'matplotlib.dateutil', 
> 'hash
> lib', 'posix', 'encodings.aliases', 'exceptions', 'sre_parse', 'pytz.bisect', 
> '
> distutils.distutils', 'copy_reg', 'sre_compile', '_hashlib', '_random', 
> 'pytz.s
> truct', 'site', '__main__', 'shutil', 'strop', 'encodings.codecs', 'gettext', 
> '
> pytz.sets', 'stat', 'warnings', 'encodings.types', 'sys', 'os.path', 
> 'pytz.gett
> ext', 'matplotlib.distutils', 'distutils.errors', 'linecache', 
> 'matplotlib.shut
> il', 'sets']
> numerix numpy 1.0.3
> font search path ['/usr/share/matplotlib/mpl-
> data/fonts/ttf', '/usr/share/matplotlib/mpl-data/fonts/afm']
> trying fontname /usr/share/matplotlib/mpl-data/fonts/ttf/cmr10.ttf
> trying fontname /usr/share/matplotlib/mpl-data/fonts/ttf/cmtt10.ttf
> trying fontname /usr/share/matplotlib/mpl-data/fonts/ttf/cmmi10.ttf
> trying fontname /usr/share/matplotlib/mpl-data/fonts/ttf/cmex10.ttf
> trying fontname /usr/share/matplotlib/mpl-data/fonts/ttf/cmsy10.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Bold.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed-
> Bold.ttf
> trying fontname 
> /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Oblique.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-
> Oblique.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Italic.ttf
> trying fontname /usr/share/fonts/truetype/freefont/FreeSerifBoldItalic.ttf
> trying fontname /usr/share/fonts/truetype/freefont/FreeMonoOblique.ttf
> trying fontname 
> /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-BoldItalic.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf
> trying fontname /usr/share/fonts/truetype/freefont/FreeSerif.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Bold.ttf
> trying fontname /usr/share/fonts/truetype/freefont/FreeSerifBold.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed-
> Italic.ttf
> trying fontname /usr/share/fonts/truetype/freefont/FreeSansOblique.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-
> Bold.ttf
> trying fontname /usr/share/fonts/truetype/freefont/FreeSansBoldOblique.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Oblique.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerifCondensed-
> BoldItalic.ttf
> trying fontname /usr/share/fonts/truetype/freefont/FreeMonoBoldOblique.ttf
> trying fontname /usr/share/fonts/truetype/freefont/FreeSansBold.ttf
> trying fontname /usr/share/fonts/truetype/freefont/FreeSans.ttf
> trying fontname 
> /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-BoldOblique.ttf
> trying fontname /usr/share/fonts/truetype/freefont/FreeMono.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-
> BoldOblique.ttf
> trying fontname /usr/share/fonts/truetype/freefont/FreeSerifItalic.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-
> BoldOblique.ttf
> trying fontname /usr/share/fonts/truetype/freefont/FreeMonoBold.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf
> trying fontname /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-ExtraLight.ttf
> $HOME=/root
> CONFIGDIR=/root/.matplotlib
> loaded ttfcache file /root/.matplotlib/ttffont.cache
> matplotlib data path /usr/share/matplotlib/mpl-data
> backend Agg version v2.2
> backend_agg.new_figure_manager
> FigureCanvasAgg.draw
> RendererAgg.__init__
> RendererAgg.__init__ width=640.0,                         height=480.0
> RendererAgg.__init__ _RendererAgg done
> RendererAgg.__init__ done
> RendererAgg._get_agg_font
>       findfont failed Arial
>       findfont failed FreeSans
> Could not match FreeSans, normal, normal.  Returning 
> /usr/share/matplotlib/mpl-
> data/fonts/ttf/cmr10.ttf
> RendererAgg._get_agg_font
> RendererAgg.draw_text
> RendererAgg._get_agg_font
> ----cut bunch of rendering stuff------
>
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
> Don't miss this year's exciting event. There's still time to save $100. 
> Use priority code J8TL2D2. 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to