API Reference for Enthought Tool Suite 2.7.1
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() method 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. |
Portions Copyright (c) Enthought, Inc. All rights reserved
This software is provided without warranty under the terms of the BSD license included in enthought/LICENSE.txt and may be redistributed only under the conditions described in the aforementioned license. The license is also available online at http://www.enthought.com/licenses/BSD.txt Thanks for using Enthought open source!
font_scalings = { Const('xx-small') : Const(0.57899999999999996), Const('x-small') : Const(0.69399999999999995), Const('small') : Const(0.83299999999999996), Const('medium') : Const(1.0), Const('large') : Const(1.2), Const('x-large') : Const(1.4399999999999999), Const('xx-large') : Const(1.728) }
fontManager = FontManager()
home = os.environ.get('HOME')
OS Font paths
MSFolders = 'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders'
MSFontDirectories = [ 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts', 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Fonts' ]
OSXFontDirectories = [ '/Library/Fonts/', '/Network/Library/Fonts/', '/System/Library/Fonts/' ]
weight_dict = { Const('light') : Const(200), Const('normal') : Const(400), Const('regular') : Const(400), Const('book') : Const(400), Const('medium') : Const(500), Const('roman') : Const(500), Const('semibold') : Const(600), Const('demibold') : Const(600), Const('demi') : Const(600), Const('bold') : Const(700), Const('heavy') : Const(800), Const('extra bold') : Const(800), Const('black') : Const(900) }
X11FontDirectories = [ '/usr/X11R6/lib/X11/fonts/TTF/', '/usr/share/fonts/', '/usr/lib/openoffice/share/fonts/truetype/' ]
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.
A function for populating the FontKey by extracting information from the AFM font file.
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.
Search for fonts in the specified font paths, or use the system paths if none given. A list of TrueType fonts are returned by default with AFM fonts as an option.
Return the string representing the configuration dir. If s is the special string _default_, use HOME/.kiva. s must be writable
Find user's home directory if possible. Otherwise raise error.
| see: | http://mail.python.org/pipermail/python-list/2005-February/263921.html |
|---|
Return the system font directories for OS X.
Get list of font files on OS X - ignores font suffix by default
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.
flatten a ttfdict to all the filenames it contains
A function for populating the FontKey by extracting information from the TrueType font file.
Return the weight property as a numeric value. String values are converted to their corresponding numeric value.
Return the user-specified font directory for Win32.
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.
Return the system font directories for X11.
| Local name | Refers to |
|---|---|
| afm | enthought.kiva.fonttools.afm |
| ETSConfig | enthought.etsconfig.etsconfig.ETSConfig |
| glob | glob |
| os | os |
| shutil | shutil |
| stat | stat |
| sys | sys |
| tempfile | tempfile |
| time | time |
| TTFont | enthought.kiva.fonttools.fontTools.ttLib.TTFont |
| TTLibError | enthought.kiva.fonttools.fontTools.ttLib.TTLibError |
| warnings | warnings |
Copyright © 2002-2008 Enthought, Inc.