I was thinking that we might want to use set_fontname() to
> find the font family and also add the specified font to the
> beginning of the list, so that it will all certainly be
> used. Otherwise, that font may be near the bottom of the
> list and not actually get used.
Just to summarize then to make sure we're all on the same page
* family lists will be moved to matplotlibrc and so will be user
configurable. This list can be overriden on a per-script basis
using the method in
* text.fontname and the other text.font* attributes in the config
file and in matplotlib.__init__ are deprecated and should warn.
The warning should point to the appropriate web page for
instruction. You should use family lists rather than fontnames for
general/global preferences. However, Text.set_fontname is
preserved and moves the named font to the head of the list
appropriate list using some kind of dictionary that maps names to
This should satisfy Perry's concern about specifying a specific
font for use in a specific place. If the font is in your system
path and the finder algorithm is working properly this font will be
used. There is one significant caveat to this, which is that it
may be difficult or impossible to specify a complete dictionary
from names to families. Or, are you reasonably certain you can
build this on the fly Paul using font properties from FT2Font?
* font.family must be one of sans-serif, serif, monospace, cursive or
fantasy. Anything else should raise
* Paul, I think when you do the documentation, some discussion of
what the different families look like, what the classic examples of
each are Eg "Courier is an example of Monospace", and a text
screenshot along the lines of examples/alignment_test.py showing an
example from each of the families would be very helpful to users.
All of this could go into htdocs/fonts.html.template and/or
* Should we add a fontfile attribute to FontProperties which defaults
to None but if not None but can be a string like 'somefile.ttf'.
FontManager.findfont would do something like
if prop.fontfile is not None:
for path in fontPaths:
fullpath = os.path.join(path, prop.fontfile):
if os.path.exists(fullpath): return fullpath
raise something # somefile.ttf is not on system
This would be for users who absolutely positively want a font from
some ttf file and don't want to mess with the rest. If we really
trust the mechanisms in set_fontname, the finder algorithm and the
name->family dictionary, this shouldn't be necessary. But we may
not fully trust all of these mechanisms and it might be nice for
people who don't want to mess with understanding fonts, families,
and the rest.