I'll make sure to describe this issue in the documentation.
> However, in reply to your comment, it is my opinion that the
> fontname attribute should be depricated in favor of
> fontfamily, which is a list of named fonts. The font
> manager has a preliminary list of recommended font families
> that the user can use. Vera is one of the named fonts in
> the 'sans' family, though not high on the list, since there
> are potentlially nicer fonts that can be used.
> The font manager prepends the list of fonts indicated by
> TTFPATH to the list of system fonts that it finds. So if
> Vera is in TTFPATH, then it should be available. If not,
> then I'll look into it.
Vera is in the path since it's in my matplotlib data dir.
> Please let me know what changes you would like to this
> module. In the mean time, I'll continue to make
> modifications.
I did a little more experimenting; I think some of the problems I was
having yesterday were from residual effects of text.fontname. To
clarify and simplify, I removed text.fontname from matplotlibrc and
matplotlib.__init__ rcParams. The ttf_microsoft fonts referred to
below are in the ttf.tar file referred to earlier; the results below
show my matplotlibrc entry and the filename returned by findfont
# ok, verdana san serif
font.family : san-serif /home/jdhunter/src/ttf_microsoft/verdana.ttf
# ok this is a serif font
font.family : serif /usr/X11R6/lib/X11/fonts/TTF/luxirr.ttf
# what's happening here? fail silently? cour.ttf is in ttf_microsoft
font.family : Courier /home/jdhunter/src/ttf_microsoft/verdana.ttf
I think the ability to define a family and let the system choose the
best match is good, but there are cases where this may not be
desirable.
* If you are an application developer and want your app to look just
the same across platforms, you may distribute it with a font file
and you want to make sure that file is chosen.
* The majority of users will probably be more familiar with the names
Courier and Times than with font families monospace and serif.
Should we provide a mechanism so that users can specify fonts this
way? Eg, you may know you have Courier on your system and you
don't care about portability. Is there a way in the current setup,
for example, a user who wants to specify Courier?
For the first of these two cases, one idea is to allow a user to
specify a filename
font.family = Vera.ttf # search path for Vera.ttf
Users who distribute apps with matplotlib and want a guaranteed font
(such as myself!) can use one of the fonts that are distributed with
matplotlib and rely on the normal environment vars (MATPLOTLIBDATA and
TTFPATH) to provide the dirs those fonts will reside in. Since no
legitimate family name or font name will match the pattern *.ttf, we
can safely do this. What do you think? If this is not sufficiently
elegant, we could consider font.file as an additional attribute which
defaults to None.
For the second of the two cases, I'm not sure....
So fontname plays no legitimate role anymore?
On an unrelated note, I don't think we need any of fontname,
fontstyle, fontangle, fontvariant or fontweight in the Text __init__
method, but we should preserve the getters and setters as discussed
earlier for user interface compatibity (the __init__ function is not
in the user interface but the text methods are).
JDH