Trees | Indices | Toggle frames |
---|
Abstract font class able to produce glyphs.
To construct a font, use pyglet.font.load, which will instantiate the platform-specific font class.
Internally, this class is used by the platform classes to manage the set of textures into which glyphs are written.
glyph_renderer_class
Abstract class for creating glyph images.
|
|
texture_class
A texture within which glyphs can be drawn.
|
__init__(self) | |
add_font_data(cls,
data)
Add font data to the font loader.
|
|
bool |
have_font(cls,
name)
Determine if a font with the given name is installed.
|
Glyph |
create_glyph(self,
image)
Create a glyph using the given image.
|
list of Glyph |
get_glyphs(self,
text)
Create and return a list of Glyphs for text.
|
list of Glyph |
get_glyphs_for_width(self,
text,
width)
Return a list of glyphs for text that fit within the given width.
|
int |
ascent = 0
Maximum ascent above the baseline, in pixels.
|
int |
descent = 0
Maximum descent below the baseline, in pixels.
|
texture_width = 256
|
|
texture_height = 256
|
|
texture_internalformat = 6406
|
Add font data to the font loader.
This is a class method and affects all fonts loaded. Data must be some byte string of data, for example, the contents of a TrueType font file. Subclasses can override this method to add the font data into the font registry.
There is no way to instantiate a font given the data directly, you must use pyglet.font.load specifying the font name.
Create a glyph using the given image.
This is used internally by Font subclasses to add glyph data to the font. Glyphs are packed within large textures maintained by Font. This method inserts the image into a font texture and returns a glyph reference; it is up to the subclass to add metadata to the glyph.
Applications should not use this method directly.
Create and return a list of Glyphs for text.
If any characters do not have a known glyph representation in this font, a substitution will be made.
Return a list of glyphs for text that fit within the given width.
If the entire text is larger than 'width', as much as possible will be
used while breaking after a space or zero-width space character. If a
newline is encountered in text, only text up to that newline will be
used. If no break opportunities (newlines or spaces) occur within
width
, the text up to the first break opportunity will be used (this
will exceed width
). If there are no break opportunities, the entire
text will be used.
You can assume that each character of the text is represented by exactly one glyph; so the amount of text "used up" can be determined by examining the length of the returned glyph list.
See Also: GlyphString
0 |
Trees | Indices | Toggle frames |
---|
Generated by Epydoc 3.0beta1 on Thu Dec 31 17:58:18 2009 | http://epydoc.sourceforge.net |