This is a longstanding known issue -- the font finding algorithm is way 
too precise, and should instead do a nearest-neighbor search similar to 
fontconfig.  It's a non-trivial bit of code that no one has yet found 
time for.

If you're running matplotlib 0.98.x and are on a non-Windows platform, 
you can try the experimental fontconfig support by changing the 
"USE_FONTCONFIG" variable to "True" in font_manager.py.  (You'll need to 
install fontconfig on OS-X -- most recent Linux distributions should 
already have it.)

Cheers,
Mike

Stan West wrote:
> Greetings.  It seems that a "not" operator got dropped in rev. 6143 to
> font_manager.py.  I've attached a patch.
>
> The missing "not" tripped up findfont when trying to match font weights: the
> code
>
>     fm = matplotlib.font_manager.FontManager()
>     fm.findfont('New Century Schoolbook', fontext='afm')
>
> was yielding '...\\matplotlib\\mpl-data\\fonts\\ttf\\Vera.ttf' instead of
> the expected '...\\matplotlib\\mpl-data\\fonts\\afm\\pncr8a.afm', because
> fm.afmdict['New Century Schoolbook']['normal']['normal'] had only the
> weights 500 and 700, not the 400 called for by the implicit normal weight in
> the findfont call.
>   
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> 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-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>   

-- 
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 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-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to