setting the font name directly

Hello,

When I need to use unicode string in matplotlib, I often set the font
name directly as below.

import matplotlib.font_manager as fm
fp1=fm.FontProperties(fname="/users/research/lee/.fonts/malgun.ttf")

This used to work. But not anymore. And I guess this is related with a
recent change in font_manager.py (r5356 by Michael),

http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/matplotlib/font_manager.py?r1=5195&r2=5356

Note that "return fname" bacame "return fname[0]".
So, its seems that now we need to provide a list of filenames for
fname parameters. And a code like below works.

fp1=fm.FontProperties(fname=["/users/research/lee/.fonts/malgun.ttf"])

Is this change intended? I just want to make sure before I start
changing my codes.
Regards,

-JJ

Yes. The FontProperties objects have a list of options that they try in order.

(The fname parameter is sort of an implementation detail rather than a public API.)

Cheers,
Mike

Jae-Joon Lee wrote:

ยทยทยท

Hello,

When I need to use unicode string in matplotlib, I often set the font
name directly as below.

import matplotlib.font_manager as fm
fp1=fm.FontProperties(fname="/users/research/lee/.fonts/malgun.ttf")

This used to work. But not anymore. And I guess this is related with a
recent change in font_manager.py (r5356 by Michael),

matplotlib download | SourceForge.net

Note that "return fname" bacame "return fname[0]".
So, its seems that now we need to provide a list of filenames for
fname parameters. And a code like below works.

fp1=fm.FontProperties(fname=["/users/research/lee/.fonts/malgun.ttf"])

Is this change intended? I just want to make sure before I start
changing my codes.
Regards,

-JJ

-------------------------------------------------------------------------
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
matplotlib-devel List Signup and Options
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA