OpenGLContext.scenegraph.text.wxfont
wxPython bitmap and texmap fonts
Classes
class _wxFontProvider(
FontProvider
):
Singleton for creating new wxBitmapFonts
Note: This provider MUST NOT be used under a non-wxPython
context under Linux/GTK, as it WILL cause segmentation
faults when the wxPython system tries to access the font
list from the wxPython application.
calculatePointSize(
self
,
fontStyle
,
family
,
face
,
mode
= None
)
Approximate point size for fontStyle with font
A wxPython-provided Bitmap Font
The wxPython fonts are image-based, non-antialiased,
and available only under wxPython contexts, though
on Win32 you can actually use them when using a non
wxPython context (they will crash or application on
GTK/Linux because the wxPython application object
is not available under other contexts).
The primary interest for wxPython fonts is the
ability to scan all currently installed fonts to find
a specified font face. At the moment, only the WGL
and wxPython fonts are able to do this.
Note:
The FontStyle.size field means something different
for bitmap-format (screen-space) fonts, as compared
to the VRML97 standard, which only considers 3D
geometric fonts. Bitmap fonts are generated at
approximately 72*FontStyle.size pixels.
__init__(
self
,
fontStyle
= None
,
font
= None
)
Initialize the wxBitmapFont object
- fontStyle
- the FontStyle node which generates this font, can be None, in which case VRML97 default semantics are used.
- font
- the wxPython font used to render the bitmaps on which we are based. Can be None, in which case we will find the appropriate font using the wx.FontProvider's match method.
createCharTexture(
self
,
char
,
mode
= None
)
Create character's texture/bitmap as a Numeric array w/ width and height
This uses PyGame and Numeric to attempt to create
an anti-aliased luminance texture-map of the given
character and return it as (data, width, height).
lists(
self
,
value
,
mode
= None
)
Get a sequence of display-list integers for value
Basically, this does a bit of trickery to do
as-required compilation of display-lists, so
that only those characters actually required
by the displayed text are compiled.
NOTE: Must be called from within the rendering
thread and within the rendering pass!