OpenGLContext.scenegraph.text.fontprovider
Base functionality for font-providers (objects creating fonts)
Classes
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
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
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
getProviderFont(
cls
,
fontStyle
,
mode
= None
)
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).
class TTFFontProvider(
FontProvider
):