Trees | Indices | Toggle frames |
---|
Render simple text and formatted documents efficiently.
Three layout classes are provided:
The entire document is laid out before it is rendered. The layout will be grouped with other layouts in the same batch (allowing for efficient rendering of multiple layouts).
Any change to the layout or document, and even querying some properties, will cause the entire document to be laid out again.
Based on TextLayout.
A separate group is used for layout which crops the contents of the layout to the layout rectangle. Additionally, the contents of the layout can be "scrolled" within that rectangle with the view_x and view_y properties.
Based on ScrollableTextLayout.
When the layout or document are modified, only the affected regions are laid out again. This permits efficient interactive editing and styling of text.
Only the visible portion of the layout is actually rendered; as the viewport is scrolled additional sections are rendered and discarded as required. This permits efficient viewing and editing of large documents.
Additionally, this class provides methods for locating the position of a caret in the document, and for displaying interactive text selections.
All three layout classes can be used with either UnformattedDocument or FormattedDocument, and can be either single-line or multiline. The combinations of these options effectively provides 12 different text display possibilities.
The following character style attribute names are recognised by the layout classes. Data types and units are as specified.
Where an attribute is marked "as a distance" the value is assumed to be in pixels if given as an int or float, otherwise a string of the form "0u" is required, where 0 is the distance and u is the unit; one of "px" (pixels), "pt" (points), "pc" (picas), "cm" (centimeters), "mm" (millimeters) or "in" (inches). For example, "14pt" is the distance covering 14 points, which at the default DPI of 96 is 18 pixels.
The following paragraph style attribute names are recognised. Note that paragraph styles are handled no differently from character styles by the document: it is the application's responsibility to set the style over an entire paragraph, otherwise results are undefined.
Other attributes can be used to store additional style information within the document; they will be ignored by the built-in text classes.
Since: pyglet 1.1
TextLayoutGroup
Top-level rendering group for TextLayout.
|
|
ScrollableTextLayoutGroup
Top-level rendering group for ScrollableTextLayout.
|
|
TextLayoutForegroundGroup
Rendering group for foreground elements (glyphs) in all text layouts.
|
|
TextLayoutForegroundDecorationGroup
Rendering group for decorative elements (e.g., glyph underlines) in all
text layouts.
|
|
TextLayoutTextureGroup
Rendering group for a glyph texture in all text layouts.
|
|
TextLayout
Lay out and display documents.
|
|
ScrollableTextLayout
Display text in a scrollable viewport.
|
|
IncrementalTextLayout
Displayed text suitable for interactive editing and/or scrolling
large documents.
|
__package__ =
|
Trees | Indices | Toggle frames |
---|
Generated by Epydoc 3.0beta1 on Thu Dec 31 17:58:18 2009 | http://epydoc.sourceforge.net |