Thanks Michael!  I installed fondu and converted my Helvetica.dfont to .ttf and put them in /Users/ybendana/Library/Fonts.  However, the fontManager was still picking up the /System/Library/Fonts/Helvetica.dfont.  As a workaround, I edited font_manager.py line 209 in findSystemFonts() to build the font cache from only .ttf fonts:

    for f in OSXInstalledFonts(fontext=fontext):

After deleting the ~/.matplotlib/ttfont.cache, it now picks up the Helvetica.ttf font.

yuri



On 9/12/07, Michael Droettboom <mdroe@stsci.edu> wrote:
Yuri,

A .dfont file can be seen as a collection of .ttf files.  A .dfont
generally will contain the regular, bold and italic versions of a font,
but matplotlib is hardcoded to only look at the first of them.  So when
you request "sans-serif", you get Helvetica.  When you request
"sans-serif:bold", it fails, (since it can't get to the bold version)
and falls back on the default matplotlib font, Vera Sans Regular.

Long term, we probably need to improve matplotlib to support dfonts
correctly.  As a workaround, you can adjust your font settings to refer
to .ttf fonts, or convert your dfonts to ttf fonts using fondu.

Cheers,
Mike

Yuri Bendaņa wrote:
> Hi,
>
> I'm a new user and I installed matplotlib 0.90.1 on Mac 10.4.9.  I'm
> using the WxAgg backend, which I installed using MacPorts.  I haven't
> had a problem so far except when I try to change font properties like
> family, fontname, and  weight.  For example, the following doesn't work:
>
> figtext(0.8,0.3,"Large Folds", weight='bold', fontname='Helvetica')
>
> I only get the default font (I believe it's Vera) and no bold.  This
> also happens with the PDF backend so I don't think that's the problem.
> I checked the fontManager object and verified that it knows where the
> fonts are installed on my Mac.  I can call findfont() and it does return
> the Helvetica font:
>
> In [10]: fm.fontManager.findfont(fm.FontProperties('sans-serif'))
> Out[10]: '/System/Library/Fonts/Helvetica.dfont'
>
> Does anyone have a solution for this?
>
> thanks,
>
> yuri
>
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

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



--
Yuri Bendaņa
Graduate Student
UC Berkeley/UCSF Joint Graduate Group in Bioengineering