Trees | Indices | Toggle frames |
---|
An immutable string of glyphs that can be rendered quickly.
This class is ideal for quickly rendering single or multi-line strings of text that use the same font. To wrap text using a glyph string, call get_break_index to find the optimal breakpoint for each line, the repeatedly call draw for each breakpoint.
Deprecated: Use pyglet.text.layout classes.
__init__(self,
text,
glyphs,
x=0,
y=0)
Create a glyph string.
|
|
int |
get_break_index(self,
from_index,
width)
Find a breakpoint within the text for a given width.
|
float |
get_subwidth(self,
from_index,
to_index)
Return the width of a slice of this string.
|
draw(self,
from_index=0,
to_index=None)
Draw a region of the glyph string.
|
Create a glyph string.
The text string is used to determine valid breakpoints; all glyphs must have already been determined using pyglet.font.base.Font.get_glyphs. The string will be positioned with the baseline of the left-most glyph at the given coordinates.
Find a breakpoint within the text for a given width.
Returns a valid breakpoint after from_index
so that the text
between from_index
and the breakpoint fits within width
pixels.
This method uses precomputed cumulative glyph widths to give quick answer, and so is much faster than pyglet.font.base.Font.get_glyphs_for_width.
from_index
if there is no valid breakpoint.Draw a region of the glyph string.
Assumes texture state is enabled. To enable the texture state:
from pyglet.gl import * glEnable(GL_TEXTURE_2D)
Trees | Indices | Toggle frames |
---|
Generated by Epydoc 3.0beta1 on Thu Dec 31 17:58:18 2009 | http://epydoc.sourceforge.net |