mpl.font_manager.FontManager¶
-
class
mpl.font_manager.FontManager(size=None, weight=u'normal')[source]¶ On import, the
FontManagersingleton instance creates a list of TrueType fonts based on the font properties: name, style, variant, weight, stretch, and size. Thefindfont()method does a nearest neighbor search to find the font that most closely matches the specification. If no good enough match is found, a default font is returned.
Methods¶
__init__([size, weight]) |
|
findfont(prop[, fontext, directory, ...]) |
Search the font list for the font that most closely matches the FontProperties prop. |
get_default_size() |
Return the default font size. |
get_default_weight() |
Return the default font weight. |
score_family(families, family2) |
Returns a match score between the list of font families in families and the font family name family2. |
score_size(size1, size2) |
Returns a match score between size1 and size2. |
score_stretch(stretch1, stretch2) |
Returns a match score between stretch1 and stretch2. |
score_style(style1, style2) |
Returns a match score between style1 and style2. |
score_variant(variant1, variant2) |
Returns a match score between variant1 and variant2. |
score_weight(weight1, weight2) |
Returns a match score between weight1 and weight2. |
set_default_weight(weight) |
Set the default font weight. |
update_fonts(filenames) |
Update the font dictionary with new font files. |