@header@
 
 
matplotlib.font_manager
index
/home/jdhunter/dev/lib64/python2.5/site-packages/matplotlib/font_manager.py

A module for finding, managing, and using fonts across-platforms.
 
This module provides a single FontManager that can be shared across
backends and platforms.  The findfont() function returns the best
TrueType (TTF) font file in the local or system font path that matches
the specified FontProperties.  The FontManager also handles Adobe Font
Metrics (AFM) font files for use by the PostScript backend.
 
The design is based on the W3C Cascading Style Sheet, Level 1 (CSS1)
font specification (http://www.w3.org/TR/1998/REC-CSS2-19980512/ ).
Future versions may implement the Level 2 or 2.1 specifications.
 
 
KNOWN ISSUES
 
  - documentation
  - font variant is untested
  - font stretch is incomplete
  - font size is incomplete
  - font size_adjust is incomplete
  - default font algorithm needs improvement and testing
  - setWeights function needs improvement
  - 'light' is an invalid weight value, remove it.
  - update_fonts not implemented
 
 
Authors   : John Hunter <jdhunter@ace.bsd.uchicago.edu>
            Paul Barrett <Barrett@STScI.Edu>
Copyright : John Hunter (2004,2005), Paul Barrett (2004,2005)
License   : matplotlib license (PSF compatible)
            The font directory code is from ttfquery,
            see license/LICENSE_TTFQUERY.

 
Modules
       
matplotlib.afm
matplotlib.ft2font
glob
matplotlib
os
cPickle
sys

 
Classes
       
__builtin__.object
FontKey
FontProperties
FontManager

 
class FontKey(__builtin__.object)
    A class for storing Font properties.  It is used when populating
the font dictionary.
 
  Methods defined here:
__init__(self, name='', style='normal', variant='normal', weight='normal', stretch='normal', size='medium')

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class FontManager
    On import, the FontManager creates a dictionary of TrueType
fonts based on the font properties: name, style, variant, weight,
stretch, and size.  The findfont() method searches this dictionary
for a font file name that exactly matches the font properties of the
specified text.  If none is found, a default font is returned.  By
updating the dictionary with the properties of the found font, the
font dictionary can act like a font cache.
 
  Methods defined here:
__init__(self, size=None, weight='normal')
findfont(self, prop, fontext='ttf')
Search the font dictionary for a font that exactly or closely
matches the specified font properties.  See the FontProperties class
for a description.
 
The properties are searched in the following order: name, style,
variant, weight, stretch, and size.  The font weight always matches
returning the closest weight, and the font size always matches for
scalable fonts.  An oblique style font will be used inplace of a
missing italic style font if present.  See the W3C Cascading Style
Sheet, Level 1 (CSS1; http://www.w3.org/TR/1998/REC-CSS2-19980512/)
documentation for a description of the font finding algorithm.
get_default_size(self)
Return the default font size.
get_default_weight(self)
Return the default font weight.
set_default_size(self, size)
Set the default font size in points.  The initial value is set by font.size in rc.
set_default_weight(self, weight)
Set the default font weight.  The initial value is 'normal'.
update_fonts(self, filenames)
Update the font dictionary with new font files.
Currently not implemented.

 
class FontProperties(__builtin__.object)
    A class for storing and manipulating font properties.
 
The font properties are those described in the W3C Cascading Style
Sheet, Level 1 (CSS1; http://www.w3.org/TR/1998/REC-CSS2-19980512/)
font specification.  The six properties are:
 
  family  - A list of font names in decreasing order of priority.
            The last item is the default font name and is given the
            name of the font family, either serif, sans-serif,
            cursive, fantasy, and monospace.
  style   - Either normal, italic or oblique.
  variant - Either normal or small-caps.
  stretch - Either an absolute value of ultra-condensed, extra-
            condensed, condensed, semi-condensed, normal, semi-
            expanded, expanded, extra-expanded or ultra-expanded;
            or a relative value of narrower or wider.
            This property is currently not implemented and is set to
            normal.
  weight  - A numeric value in the range 100, 200, 300, ..., 900.
  size    - Either an absolute value of xx-small, x-small, small,
            medium, large, x-large, xx-large; or a relative value
            of smaller or larger; or an absolute font size, e.g. 12;
            or scalable.
 
The default font property for TrueType fonts is: sans-serif, normal,
normal, normal, 400, scalable.
 
The preferred usage of font sizes is to use the relative values, e.g.
large, instead of absolute font sizes, e.g. 12.  This approach allows
all text sizes to be made larger or smaller based on the font manager's
default font size, i.e. by using the set_default_size() method of the
font manager.
 
This class will also accept a fontconfig pattern, if it is the only
argument provided.  fontconfig patterns are described here:
 
  http://www.fontconfig.org/fontconfig-user.html
 
Note that matplotlib's internal font manager and fontconfig use a
different algorithm to lookup fonts, so the results of the same pattern
may be different in matplotlib than in other applications that use
fontconfig.
 
  Methods defined here:
__hash__(self)
__init__(self, family=None, style=None, variant=None, weight=None, stretch=None, size=None, fname=None, _init=None)
__str__(self)
copy(self)
Return a deep copy of self
get_family(self)
Return a list of font names that comprise the font family.
get_file(self)
get_fontconfig_pattern(self)
get_name(self)
Return the name of the font that best matches the font properties.
get_size(self)
Return the font size.
get_size_in_points = get_size(self)
get_stretch(self)
Return the font stretch or width.  Options are: normal,
narrow, condensed, or wide.
get_style(self)
Return the font style.  Values are: normal, italic or oblique.
get_variant(self)
Return the font variant.  Values are: normal or small-caps.
get_weight(self)
Return the font weight.  See the FontProperties class for a
a list of possible values.
set_family(self, family)
Change the font family.  May be either an alias (generic name
is CSS parlance), such as: serif, sans-serif, cursive,
fantasy, or monospace, or a real font name.
set_file(self, file)
set_fontconfig_pattern(self, pattern)
set_name = set_family(self, family)
set_size(self, size)
Set the font size.
set_slant = set_style(self, style)
set_stretch(self, stretch)
Set the font stretch or width.  Options are: normal, narrow,
condensed, or wide.
set_style(self, style)
Set the font style.  Values are: normal, italic or oblique.
set_variant(self, variant)
Set the font variant.  Values are: normal or small-caps.
set_weight(self, weight)
Set the font weight.  See the FontProperties class for a
a list of possible values.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
OSXFontDirectory()
Return the system font directories for OS X.
OSXInstalledFonts(directory=None, fontext='ttf')
Get list of font files on OS X - ignores font suffix by default
add_filename(fontdict, prop, fname)
A function to add a font file name to the font dictionary using
the FontKey properties.  If a font property has no dictionary, then
create it.
afmFontProperty(font)
A function for populating the FontKey by extracting information
from the AFM font file.
createFontDict(fontfiles, fontext='ttf')
A function to create a dictionary of font file paths.  The
default is to create a dictionary for TrueType fonts.  An AFM font
dictionary can optionally be created.
findSystemFonts(fontpaths=None, fontext='ttf')
Search for fonts in the specified font paths.  If no paths are
given, will use a standard set of system paths, as well as the
list of fonts tracked by fontconfig if fontconfig is installed and
available.  A list of TrueType fonts are returned by default with
AFM fonts as an option.
findfont(prop, **kw)
get_fontconfig_fonts(fontext='ttf')
Grab a list of all the fonts that are being tracked by fontconfig.
This is an easy way to grab all of the fonts the user wants to be made
available to applications, without knowing where all of them reside.
get_fontext_synonyms(fontext)
is_opentype_cff_font(filename)
Returns True if the given font is a Postscript Compact Font Format
Font embedded in an OpenType wrapper.
pickle_dump(data, filename)
Equivalent to pickle.dump(data, open(filename, 'w'))
but closes the file to prevent filehandle leakage.
pickle_load(filename)
Equivalent to pickle.load(open(filename, 'r'))
but closes the file to prevent filehandle leakage.
setWeights(font)
A function to populate missing values in a font weight
dictionary.  This proceedure is necessary since the font finding
algorithm always matches on the weight property.
ttfFontProperty(font)
A function for populating the FontKey by extracting information
from the TrueType font file.
ttfdict_to_fnames(d)
flatten a ttfdict to all the filenames it contains
weight_as_number(weight)
Return the weight property as a numeric value.  String values
are converted to their corresponding numeric value.
win32FontDirectory()
Return the user-specified font directory for Win32.
win32InstalledFonts(directory=None, fontext='ttf')
Search for fonts in the specified font directory, or use the
system directories if none given.  A list of TrueType fonts are
returned by default with AFM fonts as an option.
x11FontDirectory()
Return the system font directories for X11.

 
Data
        MSFolders = r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'
MSFontDirectories = [r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts', r'SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts']
OSXFontDirectories = ['/Library/Fonts/', '/Network/Library/Fonts/', '/System/Library/Fonts/', '/home/jdhunter/Library/Fonts']
USE_FONTCONFIG = False
X11FontDirectories = ['/usr/X11R6/lib/X11/fonts/TTF/', '/usr/share/fonts/', '/usr/local/share/fonts/', '/usr/lib/openoffice/share/fonts/truetype/', '/home/jdhunter/.fonts']
fontManager = <matplotlib.font_manager.FontManager instance at 0x29782d8>
font_scalings = {'large': 1.2, 'larger': 1.2, 'medium': 1.0, 'small': 0.83299999999999996, 'smaller': 0.83299999999999996, 'x-large': 1.4399999999999999, 'x-small': 0.69399999999999995, 'xx-large': 1.728, 'xx-small': 0.57899999999999996}
home = '/home/jdhunter'
path = '/home/jdhunter/.fonts'
rcParams = {'figure.subplot.right': 0.90000000000000002, 'm...persize': 'letter', 'svg.embed_char_paths': True}
verbose = <matplotlib.Verbose instance at 0x28b0200>
weight_dict = {'black': 900, 'bold': 700, 'book': 400, 'demi': 600, 'demibold': 600, 'extra bold': 800, 'heavy': 800, 'light': 200, 'medium': 500, 'normal': 400, ...}
@footer@