| | |
- object
-
- FontProvider
-
- TTFFontProvider
class FontProvider(object) |
| |
Abstract base class for font-providers
The font-provider allows you to get a system-specific
font via the currently registered font-providing system.
Attributes:
fonts -- the set of instantiated fonts the provider
is currently managing. A mapping from
key: font
where key is calculated by the provider's key
method.
Class attributes:
PROVIDER_SEARCH_ORDER -- default search order for
font provider types. When you ask for a match
for a particular fontStyle the search order is
rearranged to match the fontStyle IFF the
fontStyle specifies a particular format,
otherwise the default search order is used.
providers -- the set of registered font providers |
| |
Methods defined here:
- __init__(self)
- Initialize the provider
- addFont(self, fontStyle, font, mode=None)
- Add a new font to the font provider
fontStyle -- the font style defining the font, may
be None to define the default font
font -- the provider-specific font object which
should be a sub-class of
OpenGLContext.scenegraph.text.font.Font
mode -- the active rendering mode
- clear(self)
- Force clear of the font cache for this provider
- create(self, fontStyle, mode=None)
- Create a new font for the given fontStyle and mode
- enumerate(self, mode=None)
- Iterate through all available fonts (whether instantiated or not)
These are the "low level" specifications for the fonts,
for providers with "name"-based resolution, these will
be the font-face-names, while providers with filename-
based resolution will provide filenames. Where possible,
filename-based systems should attempt to provide names
as well to allow for more flexibility in content
authoring.
- get(self, fontStyle=None, mode=None)
- Get/create a new font for the given fontStyle & mode
fontStyle -- the font style defining the font, may
be None to retrieve the default font
mode -- the active rendering mode
- key(self, fontStyle=None)
- Calculate our "font key" for the fontStyle
If the font-key changes, we should be invalidating
our caches, but at the moment we aren't caching anything
3-D providers will add the various 3-D-specific fields
from the FontStyle3D node.
Class methods defined here:
- getProviderFont(cls, fontStyle, mode=None) from type
- Get a font provider & font for given style (classmethod)
fontStyle -- a FontStyle for FontStyle3D node, or None,
determines which provider is "prefered"
mode -- active rendering mode
cls.PROVIDER_SEARCH_ORDER is used to determine the
order of fallback formats for the explicitly specified
format (if there is such a format).
- getProviders(cls, format) from type
- Get providers for a particular format (classmethod)
- registerProvider(cls, obj) from type
- Register a class as an active font-provider (classmethod)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- PROVIDER_SEARCH_ORDER = ['solid', 'texture', 'bitmap']
- providers = {'bitmap': [<OpenGLContext.scenegraph.text.glutfont._GLUTFontProvider object at 0x39a8e50>, <OpenGLContext.scenegraph.text.pygamefont._PyGameFontProvider object at 0x73bb350>, <OpenGLContext.scenegraph.text.wxfont._wxFontProvider object at 0x73c4ed0>], 'outline': [<OpenGLContext.scenegraph.text.toolsfont._ToolsFontProvider object at 0x73bbe90>], 'solid': [<OpenGLContext.scenegraph.text.toolsfont._ToolsFontProvider object at 0x73bbe50>]}
|
class TTFFontProvider(FontProvider) |
| |
Direct TrueType-font-file-based provider |
| |
- Method resolution order:
- TTFFontProvider
- FontProvider
- object
Class methods defined here:
- getTTFRegistry(cls) from type
- Set the TTF registry for the class (global if called on TTFFontProvider)
- setTTFRegistry(cls, registry) from type
- Set the TTF registry for the class (global if called on TTFFontProvider)
Data and other attributes defined here:
- TTFRegistry = None
Methods inherited from FontProvider:
- __init__(self)
- Initialize the provider
- addFont(self, fontStyle, font, mode=None)
- Add a new font to the font provider
fontStyle -- the font style defining the font, may
be None to define the default font
font -- the provider-specific font object which
should be a sub-class of
OpenGLContext.scenegraph.text.font.Font
mode -- the active rendering mode
- clear(self)
- Force clear of the font cache for this provider
- create(self, fontStyle, mode=None)
- Create a new font for the given fontStyle and mode
- enumerate(self, mode=None)
- Iterate through all available fonts (whether instantiated or not)
These are the "low level" specifications for the fonts,
for providers with "name"-based resolution, these will
be the font-face-names, while providers with filename-
based resolution will provide filenames. Where possible,
filename-based systems should attempt to provide names
as well to allow for more flexibility in content
authoring.
- get(self, fontStyle=None, mode=None)
- Get/create a new font for the given fontStyle & mode
fontStyle -- the font style defining the font, may
be None to retrieve the default font
mode -- the active rendering mode
- key(self, fontStyle=None)
- Calculate our "font key" for the fontStyle
If the font-key changes, we should be invalidating
our caches, but at the moment we aren't caching anything
3-D providers will add the various 3-D-specific fields
from the FontStyle3D node.
Class methods inherited from FontProvider:
- getProviderFont(cls, fontStyle, mode=None) from type
- Get a font provider & font for given style (classmethod)
fontStyle -- a FontStyle for FontStyle3D node, or None,
determines which provider is "prefered"
mode -- active rendering mode
cls.PROVIDER_SEARCH_ORDER is used to determine the
order of fallback formats for the explicitly specified
format (if there is such a format).
- getProviders(cls, format) from type
- Get providers for a particular format (classmethod)
- registerProvider(cls, obj) from type
- Register a class as an active font-provider (classmethod)
Data descriptors inherited from FontProvider:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from FontProvider:
- PROVIDER_SEARCH_ORDER = ['solid', 'texture', 'bitmap']
- providers = {'bitmap': [<OpenGLContext.scenegraph.text.glutfont._GLUTFontProvider object at 0x39a8e50>, <OpenGLContext.scenegraph.text.pygamefont._PyGameFontProvider object at 0x73bb350>, <OpenGLContext.scenegraph.text.wxfont._wxFontProvider object at 0x73c4ed0>], 'outline': [<OpenGLContext.scenegraph.text.toolsfont._ToolsFontProvider object at 0x73bbe90>], 'solid': [<OpenGLContext.scenegraph.text.toolsfont._ToolsFontProvider object at 0x73bbe50>]}
| |