The primary interface to this module. More...
Public Types | |
enum | FlattenFlags { FFNone = 0, FFLight = 1, FFMedium = 2, FFStrong = 4, FFDynamicMerge = 8 } |
Public Member Functions | |
TextNode (string name) | |
TextNode (string name, TextProperties const copy) | |
It's sort of a copy constructor: it copies the indicated TextProperties, without copying a complete TextNode. | |
appendText (string text) | |
Appends the indicates string to the end of the stored text. | |
appendUnicodeChar (wchar_t character) | |
Appends a single character to the end of the stored text. | |
appendWtext (string text) | |
Appends the indicates string to the end of the stored wide-character text. | |
float | calcWidth (string line) |
Returns the width of a line of text of arbitrary characters. | |
float | calcWidth (string line) |
Returns the width of a line of text of arbitrary characters. | |
float | calcWidth (wchar_t character) |
Returns the width of a single character of the font, or 0.0 if the character is not known. | |
clearAlign () | |
Restores the default alignment of the text. | |
clearBin () | |
Removes the effect of a previous call to set_bin(). | |
clearCard () | |
Specifies that a card will not be drawn behind the text. | |
clearCardBorder () | |
clearCardTexture () | |
clearDrawOrder () | |
clearFont () | |
Resets the font to the default font. | |
clearFrame () | |
Specifies that a border will not be drawn around the text. | |
clearGlyphScale () | |
clearGlyphShift () | |
clearIndent () | |
Removes the indent setting from the text. | |
clearMaxRows () | |
Resets the TextNode's default behavior of not limiting the number of rows of text. | |
clearShadow () | |
Specifies that a shadow will not be drawn behind the text. | |
clearShadowColor () | |
Removes the shadow color specification. | |
clearSlant () | |
clearSmallCaps () | |
clearSmallCapsScale () | |
clearTabWidth () | |
clearText () | |
Removes the text from the TextNode. | |
clearTextColor () | |
Removes the text color specification; the text will be colored whatever it was in the source font file. | |
clearWordwrap () | |
Removes the wordwrap setting from the TextNode. | |
forceUpdate () | |
Forces the TextNode to recompute itself now, even if it believes nothing has changed. | |
PandaNode | generate () |
Generates the text, according to the parameters indicated within the TextNode, and returns a Node that may be parented within the tree to represent it. | |
float | getBottom () |
Returns the bottommost extent of the text in local 2-d coordinates, unmodified by the set_transform() matrix. | |
VBase4 | getCardActual () |
Returns the actual dimensions of the card around the text. | |
VBase4 | getCardAsSet () |
Returns the dimensions of the card as set by set_card_as_margin() or set_card_actual(). | |
float | getCardBorderSize () |
float | getCardBorderUvPortion () |
VBase4 | getCardColor () |
bool | getCardDecal () |
Returns the card_decal flag. | |
Texture | getCardTexture () |
VBase4 | getCardTransformed () |
Returns the actual card dimensions, transformed by the matrix set by set_transform(). | |
CoordinateSystem | getCoordinateSystem () |
int | getFlattenFlags () |
Returns the flatten flags. | |
VBase4 | getFrameActual () |
Returns the actual dimensions of the frame around the text. | |
VBase4 | getFrameAsSet () |
Returns the dimensions of the frame as set by set_frame_as_margin() or set_frame_actual(). | |
VBase4 | getFrameColor () |
bool | getFrameCorners () |
float | getFrameLineWidth () |
Returns the thickness of the lines that will be used to draw the frame. | |
float | getHeight () |
Returns the net height of the text in local 2-d coordinates. | |
PandaNode | getInternalGeom () |
Returns the actual node that is used internally to render the text, if the TextNode is parented within the scene graph. | |
float | getLeft () |
Returns the leftmost extent of the text in local 2-d coordinates, unmodified by the set_transform() matrix. | |
float | getLineHeight () |
Returns the number of units high each line of text is. | |
Point3 | getLowerRight3d () |
Returns the lower-right extent of the text object, after it has been transformed into 3-d space by applying the set_transform() matrix. | |
int | getMaxRows () |
Returns the limit on the height of the TextNode specified by set_max_rows(). | |
int | getNumRows () |
Returns the number of rows of text that were generated. | |
float | getRight () |
Returns the rightmost extent of the text in local 2-d coordinates, unmodified by the set_transform() matrix. | |
float | getTop () |
Returns the topmost extent of the text in local 2-d coordinates, unmodified by the set_transform() matrix. | |
Mat4 | getTransform () |
Returns the transform that has been set on this particular node. | |
Point3 | getUpperLeft3d () |
Returns the upper-left extent of the text object, after it has been transformed into 3-d space by applying the set_transform() matrix. | |
UsageHint | getUsageHint () |
Returns the UsageHint that will be applied to generated geometry. | |
float | getWidth () |
Returns the net width of the text in local 2-d coordinates. | |
string | getWordwrappedText () |
Returns a string that represents the contents of the text, as it has been formatted by wordwrap rules. | |
string | getWordwrappedWtext () |
Returns a wstring that represents the contents of the text, as it has been formatted by wordwrap rules. | |
bool | hasCard () |
bool | hasCardBorder () |
bool | hasCardTexture () |
bool | hasCharacter (wchar_t character) |
Returns true if the named character exists in the font or can be synthesized by Panda, false otherwise. | |
bool | hasExactCharacter (wchar_t character) |
Returns true if the named character exists in the font exactly as named, false otherwise. | |
bool | hasFrame () |
bool | hasMaxRows () |
Returns true if a limit on the height of the TextNode has been set via set_max_rows(), false otherwise. | |
bool | hasOverflow () |
Returns true if the last text set on the text node exceeded the max_rows constraint, or false if it all fit. | |
bool | isCardAsMargin () |
If this is true, the card was set via a call to set_card_as_margin(), and the dimension of the card as returned by get_card_as_set() represent a margin all around the text. | |
bool | isFrameAsMargin () |
If this is true, the frame was set via a call to set_frame_as_margin(), and the dimension of the frame as returned by get_frame_as_set() represent a margin all around the text. | |
bool | isWhitespace (wchar_t character) |
Returns true if the indicated character represents whitespace in the font, or false if anything visible will be rendered for it. | |
output (ostream out) | |
Outputs the Namable. | |
setAlign (Alignment align_type) | |
Specifies the alignment of the text within its margins. | |
setBin (string bin) | |
Names the GeomBin that the TextNode geometry should be assigned to. | |
setCardActual (float left, float right, float bottom, float top) | |
Similar to set_card_as_margin, except the card is specified in actual coordinate units (relative to the text's origin), irrespective of the size of the text. | |
setCardAsMargin (float left, float right, float bottom, float top) | |
Specifies that a (possibly opaque or semitransparent) card will be held behind the text when it is next created. | |
setCardBorder (float size, float uv_portion) | |
setCardColor (VBase4 const card_color) | |
setCardColor (float r, float g, float b, float a) | |
setCardDecal (bool card_decal) | |
Sets the card_decal flag. | |
setCardTexture (Texture card_texture) | |
setCoordinateSystem (CoordinateSystem cs) | |
Specifies the coordinate system in which the text will be generated. | |
int | setDrawOrder (int draw_order) |
Sets the drawing order of text created by the TextMaker. | |
setFlattenFlags (int flatten_flags) | |
Sets the flatten flags. | |
setFont (TextFont font) | |
Sets the font that will be used when making text. | |
setFrameActual (float left, float right, float bottom, float top) | |
Similar to set_frame_as_margin, except the frame is specified in actual coordinate units (relative to the text's origin), irrespective of the size of the text. | |
setFrameAsMargin (float left, float right, float bottom, float top) | |
Specifies that a border will be drawn around the text when it is next created. | |
setFrameColor (VBase4 const frame_color) | |
setFrameColor (float r, float g, float b, float a) | |
setFrameCorners (bool corners) | |
Enables or disables the drawing of corners for the frame. | |
setFrameLineWidth (float line_width) | |
Specifies the thickness of the lines that will be used to draw the frame. | |
setGlyphScale (float glyph_scale) | |
Specifies the factor by which to scale each letter of the text as it is placed. | |
setGlyphShift (float glyph_shift) | |
Specifies a vertical amount to shift each letter of the text as it is placed. | |
setIndent (float indent) | |
Specifies the amount of extra space that is inserted before the first character of each line. | |
setMaxRows (int max_rows) | |
Sets the maximum number of rows that may be formatted by the TextNode. | |
setShadow (VBase2 const shadow_offset) | |
Specifies that the text should be drawn with a shadow, by creating a second copy of the text and offsetting it slightly behind the first. | |
setShadow (float xoffset, float yoffset) | |
Specifies that the text should be drawn with a shadow, by creating a second copy of the text and offsetting it slightly behind the first. | |
setShadowColor (VBase4 const shadow_color) | |
setShadowColor (float r, float g, float b, float a) | |
setSlant (float slant) | |
Specifies the factor by which the text slants to the right. | |
setSmallCaps (bool small_caps) | |
Sets the small_caps flag. | |
setSmallCapsScale (float small_caps_scale) | |
Sets the scale factor applied to lowercase letters from their uppercase equivalents, when the small_caps flag is in effect. | |
setTabWidth (float tab_width) | |
Sets the width of each tab stop, in screen units. | |
setText (string text) | |
Changes the text that is displayed under the TextNode. | |
setText (string text, Encoding encoding) | |
The two-parameter version of set_text() accepts an explicit encoding; the text is immediately decoded and stored as a wide-character string. | |
setTextColor (VBase4 const text_color) | |
setTextColor (float r, float g, float b, float a) | |
setTransform (Mat4 const transform) | |
Sets an additional transform that is applied to the entire text paragraph. | |
setUsageHint (UsageHint usage_hint) | |
Specifies the UsageHint that will be applied to generated geometry. | |
setWordwrap (float wordwrap) | |
Sets the text up to automatically wordwrap when it exceeds the indicated width. | |
setWtext (string wtext) | |
Changes the text that is displayed under the TextNode, with a wide text. | |
update () | |
Can be called after the TextNode has been fully configured, to force the node to recompute its text immediately, rather than waiting for it to be drawn. | |
write (ostream out, int indent_level) | |
write (ostream out) | |
Static Public Member Functions | |
static TypeHandle | getClassType () |
The primary interface to this module.
This class does basic text assembly; given a string of text and a TextFont object, it creates a piece of geometry that may be placed in the 3-d or 2-d world to represent the indicated text.
The TextNode may be used in one of two ways. Naively, it may simply be parented directly into the scene graph and rendered as if it were a GeomNode; in this mode, the actual polygon geometry that renders the text is not directly visible or accessible, but remains hidden within the TextNode.
The second way TextNode may be used is as a text generator. To use it in this way, do not parent the TextNode to the scene graph; instead, set the properties of the text and call generate() to return an ordinary node, containing ordinary geometry, which you may use however you like. Each time you call generate() a new node is returned.
enum FlattenFlags |
TextNode | ( | string | name | ) |
TextNode | ( | string | name, |
TextProperties const | copy | ||
) |
It's sort of a copy constructor: it copies the indicated TextProperties, without copying a complete TextNode.
appendText | ( | string | text | ) |
Appends the indicates string to the end of the stored text.
Reimplemented from TextEncoder.
appendUnicodeChar | ( | wchar_t | character | ) |
Appends a single character to the end of the stored text.
This may be a wide character, up to 16 bits in Unicode.
appendWtext | ( | string | text | ) |
Appends the indicates string to the end of the stored wide-character text.
Reimplemented from TextEncoder.
float calcWidth | ( | string | line | ) |
Returns the width of a line of text of arbitrary characters.
The line should not include the newline character.
float calcWidth | ( | string | line | ) |
Returns the width of a line of text of arbitrary characters.
The line should not include the newline character or any embedded control characters like \1 or \3.
float calcWidth | ( | wchar_t | character | ) |
Returns the width of a single character of the font, or 0.0 if the character is not known.
This may be a wide character (greater than 255).
clearAlign | ( | ) |
Restores the default alignment of the text.
Reimplemented from TextProperties.
clearBin | ( | ) |
Removes the effect of a previous call to set_bin().
Text will be drawn in whatever bin it would like to be drawn in, with no explicit ordering.
Reimplemented from TextProperties.
clearCard | ( | ) |
Specifies that a card will not be drawn behind the text.
clearCardBorder | ( | ) |
clearCardTexture | ( | ) |
clearDrawOrder | ( | ) |
Reimplemented from TextProperties.
clearFont | ( | ) |
Resets the font to the default font.
Reimplemented from TextProperties.
clearFrame | ( | ) |
Specifies that a border will not be drawn around the text.
clearGlyphScale | ( | ) |
Reimplemented from TextProperties.
clearGlyphShift | ( | ) |
Reimplemented from TextProperties.
clearIndent | ( | ) |
Removes the indent setting from the text.
Text will be as wide as it is.
Reimplemented from TextProperties.
clearMaxRows | ( | ) |
Resets the TextNode's default behavior of not limiting the number of rows of text.
clearShadow | ( | ) |
Specifies that a shadow will not be drawn behind the text.
Reimplemented from TextProperties.
clearShadowColor | ( | ) |
Removes the shadow color specification.
Reimplemented from TextProperties.
clearSlant | ( | ) |
Reimplemented from TextProperties.
clearSmallCaps | ( | ) |
Reimplemented from TextProperties.
Reimplemented from TextProperties.
clearTabWidth | ( | ) |
Reimplemented from TextProperties.
clearText | ( | ) |
Removes the text from the TextNode.
Reimplemented from TextEncoder.
clearTextColor | ( | ) |
Removes the text color specification; the text will be colored whatever it was in the source font file.
Reimplemented from TextProperties.
clearWordwrap | ( | ) |
Removes the wordwrap setting from the TextNode.
Text will be as wide as it is.
Reimplemented from TextProperties.
forceUpdate | ( | ) |
Generates the text, according to the parameters indicated within the TextNode, and returns a Node that may be parented within the tree to represent it.
float getBottom | ( | ) |
Returns the bottommost extent of the text in local 2-d coordinates, unmodified by the set_transform() matrix.
VBase4 getCardActual | ( | ) |
Returns the actual dimensions of the card around the text.
If the card was set via set_card_as_margin(), the result returned by this function reflects the size of the current text; if the card was set via set_card_actual(), this returns the values actually set.
If the text has no card at all, this returns the dimensions of the text itself, as if the card were set with a margin of 0, 0, 0, 0.
VBase4 getCardAsSet | ( | ) |
Returns the dimensions of the card as set by set_card_as_margin() or set_card_actual().
Use is_card_actual() to determine how to interpret the values returned by this function. It is an error to call this if has_card() is false.
float getCardBorderSize | ( | ) |
float getCardBorderUvPortion | ( | ) |
VBase4 getCardColor | ( | ) |
bool getCardDecal | ( | ) |
Returns the card_decal flag.
See set_card_decal().
Returns the actual card dimensions, transformed by the matrix set by set_transform().
This returns the card dimensions in actual coordinates as seen by the rest of the world. Also see get_upper_left_3d() and get_lower_right_3d().
static TypeHandle getClassType | ( | ) | [static] |
Reimplemented from PandaNode.
Reimplemented in SceneGraphAnalyzerMeter, and FrameRateMeter.
int getFlattenFlags | ( | ) |
Returns the flatten flags.
See set_flatten_flags().
VBase4 getFrameActual | ( | ) |
Returns the actual dimensions of the frame around the text.
If the frame was set via set_frame_as_margin(), the result returned by this function reflects the size of the current text; if the frame was set via set_frame_actual(), this returns the values actually set.
If the text has no frame at all, this returns the dimensions of the text itself, as if the frame were set with a margin of 0, 0, 0, 0.
VBase4 getFrameAsSet | ( | ) |
Returns the dimensions of the frame as set by set_frame_as_margin() or set_frame_actual().
Use is_frame_actual() to determine how to interpret the values returned by this function. It is an error to call this if has_frame() is false.
VBase4 getFrameColor | ( | ) |
bool getFrameCorners | ( | ) |
float getFrameLineWidth | ( | ) |
Returns the thickness of the lines that will be used to draw the frame.
float getHeight | ( | ) |
Returns the net height of the text in local 2-d coordinates.
Returns the actual node that is used internally to render the text, if the TextNode is parented within the scene graph.
In general, you should not call this method. Call generate() instead if you want to get a handle to geometry that represents the text. This method is provided as a debugging aid only.
float getLeft | ( | ) |
Returns the leftmost extent of the text in local 2-d coordinates, unmodified by the set_transform() matrix.
float getLineHeight | ( | ) |
Returns the number of units high each line of text is.
This is based on the font. Note that it is possible for the text to include nested font change commands, in which case the value of this method is questionable.
Returns the lower-right extent of the text object, after it has been transformed into 3-d space by applying the set_transform() matrix.
int getMaxRows | ( | ) |
Returns the limit on the height of the TextNode specified by set_max_rows().
int getNumRows | ( | ) |
Returns the number of rows of text that were generated.
This counts word-wrapped rows as well as rows generated due to embedded newlines.
float getRight | ( | ) |
Returns the rightmost extent of the text in local 2-d coordinates, unmodified by the set_transform() matrix.
float getTop | ( | ) |
Returns the topmost extent of the text in local 2-d coordinates, unmodified by the set_transform() matrix.
Mat4 getTransform | ( | ) |
Returns the transform that has been set on this particular node.
This is not the net transform from the root, but simply the transform on this particular node.
Reimplemented from PandaNode.
Point3 getUpperLeft3d | ( | ) |
Returns the upper-left extent of the text object, after it has been transformed into 3-d space by applying the set_transform() matrix.
UsageHint getUsageHint | ( | ) |
Returns the UsageHint that will be applied to generated geometry.
See set_usage_hint().
float getWidth | ( | ) |
Returns the net width of the text in local 2-d coordinates.
string getWordwrappedText | ( | ) |
Returns a string that represents the contents of the text, as it has been formatted by wordwrap rules.
In earlier versions, this did not contain any embedded special characters like \1 or \3; now it does.
string getWordwrappedWtext | ( | ) |
Returns a wstring that represents the contents of the text, as it has been formatted by wordwrap rules.
In earlier versions, this did not contain any embedded special characters like \1 or \3; now it does.
bool hasCard | ( | ) |
bool hasCardBorder | ( | ) |
bool hasCardTexture | ( | ) |
bool hasCharacter | ( | wchar_t | character | ) |
Returns true if the named character exists in the font or can be synthesized by Panda, false otherwise.
(Panda can synthesize some accented characters by combining similar-looking glyphs from the font.)
This returns true for whitespace and Unicode whitespace characters (if they exist in the font), but returns false for characters that would render with the "invalid glyph".
bool hasExactCharacter | ( | wchar_t | character | ) |
Returns true if the named character exists in the font exactly as named, false otherwise.
Note that because Panda can assemble glyphs together automatically using cheesy accent marks, this is not a reliable indicator of whether a suitable glyph can be rendered for the character. For that, use has_character() instead.
This returns true for whitespace and Unicode whitespace characters (if they exist in the font), but returns false for characters that would render with the "invalid glyph". It also returns false for characters that would be synthesized within Panda, but see has_character().
bool hasFrame | ( | ) |
bool hasMaxRows | ( | ) |
Returns true if a limit on the height of the TextNode has been set via set_max_rows(), false otherwise.
bool hasOverflow | ( | ) |
Returns true if the last text set on the text node exceeded the max_rows constraint, or false if it all fit.
bool isCardAsMargin | ( | ) |
If this is true, the card was set via a call to set_card_as_margin(), and the dimension of the card as returned by get_card_as_set() represent a margin all around the text.
If false, then the card was set via a call to set_card_actual(), and the dimensions of the card as returned by get_card_as_set() are relative to the text's origin.
bool isFrameAsMargin | ( | ) |
If this is true, the frame was set via a call to set_frame_as_margin(), and the dimension of the frame as returned by get_frame_as_set() represent a margin all around the text.
If false, then the frame was set via a call to set_frame_actual(), and the dimensions of the frame as returned by get_frame_as_set() are relative to the text's origin.
bool isWhitespace | ( | wchar_t | character | ) |
Returns true if the indicated character represents whitespace in the font, or false if anything visible will be rendered for it.
This returns true for whitespace and Unicode whitespace characters (if they exist in the font), and returns false for any other characters, including characters that do not exist in the font (these would be rendered with the "invalid glyph", which is visible).
Note that this function can be reliably used to identify Unicode whitespace characters only if the font has all of the whitespace characters defined. It will return false for any character not in the font, even if it is an official Unicode whitespace character.
Specifies the alignment of the text within its margins.
Reimplemented from TextProperties.
setBin | ( | string | bin | ) |
Names the GeomBin that the TextNode geometry should be assigned to.
If this is set, then a GeomBinTransition will be created to explicitly place each component in the named bin.
The draw_order value will also be passed to each GeomBinTransition as appropriate; this is particularly useful if this names a GeomBinFixed, e.g. "fixed".
Reimplemented from TextProperties.
setCardActual | ( | float | left, |
float | right, | ||
float | bottom, | ||
float | top | ||
) |
Similar to set_card_as_margin, except the card is specified in actual coordinate units (relative to the text's origin), irrespective of the size of the text.
The left and bottom coordinates should generally be negative, while the right and top coordinates should generally be positive.
setCardAsMargin | ( | float | left, |
float | right, | ||
float | bottom, | ||
float | top | ||
) |
Specifies that a (possibly opaque or semitransparent) card will be held behind the text when it is next created.
Like set_frame_as_margin, the parameters are the amount of additional padding to insert around the text in each dimension, and all should generally be positive.
setCardBorder | ( | float | size, |
float | uv_portion | ||
) |
setCardColor | ( | VBase4 const | card_color | ) |
setCardColor | ( | float | r, |
float | g, | ||
float | b, | ||
float | a | ||
) |
setCardDecal | ( | bool | card_decal | ) |
Sets the card_decal flag.
When this is true, the text is decalled onto the card, which is necessary if the TextNode is to be rendered in the 3-d world without putting it in a bin.
setCardTexture | ( | Texture | card_texture | ) |
Specifies the coordinate system in which the text will be generated.
int setDrawOrder | ( | int | draw_order | ) |
Sets the drawing order of text created by the TextMaker.
This is actually the draw order of the card and frame. The shadow is drawn at _draw_order+1, and the text at _draw_order+2.
This affects the sorting order assigned to the arcs as they are created, and also is passed to whatever bin may be assigned via set_bin().
The return value is the first unused draw_order number, e.g. _draw_order + 3.
Reimplemented from TextProperties.
setFlattenFlags | ( | int | flatten_flags | ) |
Sets the flatten flags.
This should be a union of the TextNode::FlattenFlags options. This controls the degree of flattening performed on the TextNode's internal geometry (i.e. the scene graph returned by generate()) each time the text is changed. In general, more flattening means a more optimal result, but it will take more time to generate.
The choice may be any of these three:
FF_none - No flatten operation is called. The letters are left as independent Geoms.
FF_light - A flatten_light() operation is called. The attributes are applied to the vertices, but no nodes are removed.
FF_medium - A flatten_medium() operation is called. The attributes are applied to the vertices, and a few trivial nodes are removed.
FF_strong - A flatten_strong() operation is called. The attributes are applied to the vertices, and the resulting nodes are aggressively combined into as few nodes as possible.
In addition to the above choices, you may optionally include the following flag:
FF_dynamic_merge - Copy the geoms into a single GeomVertexData as we go, instead of relying on the flatten operation at the end. This pre-flattens the text considerably, and may obviate the need for flatten altogether; it also tends to improve performance considerably even if you do call flatten. However, it is not as fast as not calling flatten at all.
The default is taken from the text-flatten and text-dynamic-merge config variables.
Sets the font that will be used when making text.
If this is set to NULL, the default font will be used, which can be set via set_default_font().
Reimplemented from TextProperties.
setFrameActual | ( | float | left, |
float | right, | ||
float | bottom, | ||
float | top | ||
) |
Similar to set_frame_as_margin, except the frame is specified in actual coordinate units (relative to the text's origin), irrespective of the size of the text.
The left and bottom coordinates should generally be negative, while the right and top coordinates should generally be positive.
setFrameAsMargin | ( | float | left, |
float | right, | ||
float | bottom, | ||
float | top | ||
) |
Specifies that a border will be drawn around the text when it is next created.
The parameters are the amount of additional padding to insert between the frame and the text in each dimension, and all should generally be positive.
setFrameColor | ( | VBase4 const | frame_color | ) |
setFrameColor | ( | float | r, |
float | g, | ||
float | b, | ||
float | a | ||
) |
setFrameCorners | ( | bool | corners | ) |
Enables or disables the drawing of corners for the frame.
These are extra points drawn at each of the four corners, to soften the ugly edges generated when the line width is greater than one.
setFrameLineWidth | ( | float | line_width | ) |
Specifies the thickness of the lines that will be used to draw the frame.
setGlyphScale | ( | float | glyph_scale | ) |
Specifies the factor by which to scale each letter of the text as it is placed.
This can be used (possibly in conjunction with set_glyph_shift()) to implement superscripting or subscripting.
Reimplemented from TextProperties.
setGlyphShift | ( | float | glyph_shift | ) |
Specifies a vertical amount to shift each letter of the text as it is placed.
This can be used (possibly in conjunction with set_glyph_scale()) to implement superscripting or subscripting.
Reimplemented from TextProperties.
setIndent | ( | float | indent | ) |
Specifies the amount of extra space that is inserted before the first character of each line.
This can be thought of as a left margin.
Reimplemented from TextProperties.
setMaxRows | ( | int | max_rows | ) |
Sets the maximum number of rows that may be formatted by the TextNode.
If more text than this is attempted, it will be truncated and has_overflow() will return true.
Specifies that the text should be drawn with a shadow, by creating a second copy of the text and offsetting it slightly behind the first.
Reimplemented from TextProperties.
setShadow | ( | float | xoffset, |
float | yoffset | ||
) |
Specifies that the text should be drawn with a shadow, by creating a second copy of the text and offsetting it slightly behind the first.
Reimplemented from TextProperties.
setShadowColor | ( | VBase4 const | shadow_color | ) |
Reimplemented from TextProperties.
setShadowColor | ( | float | r, |
float | g, | ||
float | b, | ||
float | a | ||
) |
Reimplemented from TextProperties.
setSlant | ( | float | slant | ) |
Specifies the factor by which the text slants to the right.
Reimplemented from TextProperties.
setSmallCaps | ( | bool | small_caps | ) |
Sets the small_caps flag.
When this is set, lowercase letters are generated as scaled-down versions of their uppercase equivalents. This is particularly useful to set for fonts that do not have lowercase letters.
It is also a good idea to set this for a (dynamic) font that has already implemented lowercase letters as scaled-down versions of their uppercase equivalents, since without this flag the texture memory may needlessly duplicate equivalent glyphs for upper and lowercase letters. Setting this flag causes the texture memory to share the mixed-case letters.
The amount by which the lowercase letters are scaled is specified by set_small_caps_scale().
Reimplemented from TextProperties.
setSmallCapsScale | ( | float | small_caps_scale | ) |
Sets the scale factor applied to lowercase letters from their uppercase equivalents, when the small_caps flag is in effect.
See set_small_caps(). Normally, this will be a number less than one.
Reimplemented from TextProperties.
setTabWidth | ( | float | tab_width | ) |
Sets the width of each tab stop, in screen units.
A tab character embedded in the text will advance the horizontal position to the next tab stop.
Reimplemented from TextProperties.
setText | ( | string | text | ) |
Changes the text that is displayed under the TextNode.
Reimplemented from TextEncoder.
The two-parameter version of set_text() accepts an explicit encoding; the text is immediately decoded and stored as a wide-character string.
Subsequent calls to get_text() will return the same text re-encoded using whichever encoding is specified by set_encoding().
Reimplemented from TextEncoder.
setTextColor | ( | VBase4 const | text_color | ) |
Reimplemented from TextProperties.
setTextColor | ( | float | r, |
float | g, | ||
float | b, | ||
float | a | ||
) |
Reimplemented from TextProperties.
setTransform | ( | Mat4 const | transform | ) |
Sets an additional transform that is applied to the entire text paragraph.
setUsageHint | ( | UsageHint | usage_hint | ) |
Specifies the UsageHint that will be applied to generated geometry.
The default is UH_static, which is probably the right setting, but if you know the TextNode's geometry will have a short lifespan, it may be better to set it to UH_stream. See geomEnums.h.
setWordwrap | ( | float | wordwrap | ) |
Sets the text up to automatically wordwrap when it exceeds the indicated width.
This can be thought of as a right margin or margin width.
Reimplemented from TextProperties.
setWtext | ( | string | wtext | ) |
Changes the text that is displayed under the TextNode, with a wide text.
This automatically sets the string reported by get_text() to the 8-bit encoded version of the same string.
Reimplemented from TextEncoder.
update | ( | ) |
Can be called after the TextNode has been fully configured, to force the node to recompute its text immediately, rather than waiting for it to be drawn.
This call is optional.
Reimplemented in SceneGraphAnalyzerMeter, and FrameRateMeter.
Reimplemented from TextProperties.