TextNode
from panda3d.core import TextNode
- class TextNode
Bases:
PandaNode
,TextEncoder
,TextProperties
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.
Inheritance diagram
- FFDynamicMerge = 8
- FFLight = 1
- FFMedium = 2
- FFNone = 0
- FFStrong = 4
- FF_dynamic_merge = 8
- FF_light = 1
- FF_medium = 2
- FF_none = 0
- FF_strong = 4
- __init__(*args, **kwargs)
- align
- bin
Returns the drawing bin set with set_bin(), or empty string if no bin has been set.
- calcWidth()
C++ Interface: calc_width(TextNode self, unicode line) calc_width(TextNode self, str line) calc_width(TextNode self, unicode char character)
// These methods calculate the width of a single character or a line of text // in the current font.
- /**
Returns the width of a line of text of arbitrary characters. The line
should not include the newline 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).
*/
- /**
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.
*/
- calc_width()
C++ Interface: calc_width(TextNode self, unicode line) calc_width(TextNode self, str line) calc_width(TextNode self, unicode char character)
// These methods calculate the width of a single character or a line of text // in the current font.
- /**
Returns the width of a line of text of arbitrary characters. The line
should not include the newline 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).
*/
- /**
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.
*/
- card_color
- card_texture
- clearBin()
C++ Interface: clear_bin(const TextNode self)
- /**
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.
*/
- clearCard()
C++ Interface: clear_card(const TextNode self)
- /**
Specifies that a card will not be drawn behind the text.
*/
- clearFont()
C++ Interface: clear_font(const TextNode self)
- /**
Resets the font to the default font.
*/
- clearFrame()
C++ Interface: clear_frame(const TextNode self)
- /**
Specifies that a border will not be drawn around the text.
*/
- clearMaxRows()
C++ Interface: clear_max_rows(const TextNode self)
- /**
Resets the TextNode’s default behavior of not limiting the number of rows
of text.
*/
- clearShadow()
C++ Interface: clear_shadow(const TextNode self)
- /**
Specifies that a shadow will not be drawn behind the text.
*/
- clearTextColor()
C++ Interface: clear_text_color(const TextNode self)
- /**
Removes the text color specification; the text will be colored whatever it
was in the source font file.
*/
- clearWordwrap()
C++ Interface: clear_wordwrap(const TextNode self)
- /**
Removes the wordwrap setting from the TextNode. Text will be as wide as it
is.
*/
- clear_bin()
C++ Interface: clear_bin(const TextNode self)
- /**
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.
*/
- clear_card()
C++ Interface: clear_card(const TextNode self)
- /**
Specifies that a card will not be drawn behind the text.
*/
- clear_font()
C++ Interface: clear_font(const TextNode self)
- /**
Resets the font to the default font.
*/
- clear_frame()
C++ Interface: clear_frame(const TextNode self)
- /**
Specifies that a border will not be drawn around the text.
*/
- clear_max_rows()
C++ Interface: clear_max_rows(const TextNode self)
- /**
Resets the TextNode’s default behavior of not limiting the number of rows
of text.
*/
- clear_shadow()
C++ Interface: clear_shadow(const TextNode self)
- /**
Specifies that a shadow will not be drawn behind the text.
*/
- clear_text_color()
C++ Interface: clear_text_color(const TextNode self)
- /**
Removes the text color specification; the text will be colored whatever it
was in the source font file.
*/
- clear_wordwrap()
C++ Interface: clear_wordwrap(const TextNode self)
- /**
Removes the wordwrap setting from the TextNode. Text will be as wide as it
is.
*/
- coordinate_system
- draw_order
Returns the drawing order set with set_draw_order().
- flatten_flags
- font
Returns the font currently in use, if any. If no font is in use, this returns the default font.
- forceUpdate()
C++ Interface: force_update(const TextNode self)
- /**
Forces the TextNode to recompute itself now, even if it believes nothing
has changed. Normally, this should not need to be called, but it may be
useful if some properties change outside of the TextNode’s knowledge (for
instance, within the font).
*/
- force_update()
C++ Interface: force_update(const TextNode self)
- /**
Forces the TextNode to recompute itself now, even if it believes nothing
has changed. Normally, this should not need to be called, but it may be
useful if some properties change outside of the TextNode’s knowledge (for
instance, within the font).
*/
- frame_color
- frame_corners
- frame_line_width
- generate()
C++ Interface: generate(const TextNode self)
- /**
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.
*/
- getBottom()
C++ Interface: get_bottom(TextNode self)
- /**
Returns the bottommost extent of the text in local 2-d coordinates,
unmodified by the set_transform() matrix.
*/
- getCardActual()
C++ Interface: get_card_actual(TextNode self)
- /**
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.
*/
- getCardAsSet()
C++ Interface: get_card_as_set(TextNode self)
- /**
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.
*/
- getCardDecal()
C++ Interface: get_card_decal(TextNode self)
- /**
Returns the card_decal flag. See set_card_decal().
*/
- getCardTransformed()
C++ Interface: get_card_transformed(TextNode self)
- /**
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().
*/
- getClassType()
C++ Interface: get_class_type()
- getFlattenFlags()
C++ Interface: get_flatten_flags(TextNode self)
- /**
Returns the flatten flags. See set_flatten_flags().
*/
- getFrameActual()
C++ Interface: get_frame_actual(TextNode self)
- /**
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.
*/
- getFrameAsSet()
C++ Interface: get_frame_as_set(TextNode self)
- /**
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.
*/
- getFrameLineWidth()
C++ Interface: get_frame_line_width(TextNode self)
- /**
Returns the thickness of the lines that will be used to draw the frame.
*/
- getHeight()
C++ Interface: get_height(TextNode self)
- /**
Returns the net height of the text in local 2-d coordinates.
*/
- getInternalGeom()
C++ Interface: get_internal_geom(TextNode self)
- /**
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.
*/
- getLeft()
C++ Interface: get_left(TextNode self)
// The following functions return information about the text that was last // built (and is currently visible).
- /**
Returns the leftmost extent of the text in local 2-d coordinates,
unmodified by the set_transform() matrix.
*/
- getLineHeight()
C++ Interface: get_line_height(TextNode self)
- /**
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.
*/
- getLowerRight3d()
C++ Interface: get_lower_right_3d(TextNode self)
- /**
Returns the lower-right extent of the text object, after it has been
transformed into 3-d space by applying the set_transform() matrix.
*/
- getMaxRows()
C++ Interface: get_max_rows(TextNode self)
- /**
Returns the limit on the height of the TextNode specified by
set_max_rows().
*/
- getNumRows()
C++ Interface: get_num_rows(TextNode self)
- /**
Returns the number of rows of text that were generated. This counts word-
wrapped rows as well as rows generated due to embedded newlines.
*/
- getRight()
C++ Interface: get_right(TextNode self)
- /**
Returns the rightmost extent of the text in local 2-d coordinates,
unmodified by the set_transform() matrix.
*/
- getTop()
C++ Interface: get_top(TextNode self)
- /**
Returns the topmost extent of the text in local 2-d coordinates, unmodified
by the set_transform() matrix.
*/
- getUpperLeft3d()
C++ Interface: get_upper_left_3d(TextNode self)
- /**
Returns the upper-left extent of the text object, after it has been
transformed into 3-d space by applying the set_transform() matrix.
*/
- getUsageHint()
C++ Interface: get_usage_hint(TextNode self)
- /**
Returns the UsageHint that will be applied to generated geometry. See
set_usage_hint().
*/
- getWidth()
C++ Interface: get_width(TextNode self)
- /**
Returns the net width of the text in local 2-d coordinates.
*/
- getWordwrappedText()
C++ Interface: get_wordwrapped_text(TextNode self)
// After the text has been set, you can query this to determine how it will // be wordwrapped.
- /**
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.
*/
- getWordwrappedWtext()
C++ Interface: get_wordwrapped_wtext(TextNode self)
- /**
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.
*/
- get_bottom()
C++ Interface: get_bottom(TextNode self)
- /**
Returns the bottommost extent of the text in local 2-d coordinates,
unmodified by the set_transform() matrix.
*/
- get_card_actual()
C++ Interface: get_card_actual(TextNode self)
- /**
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.
*/
- get_card_as_set()
C++ Interface: get_card_as_set(TextNode self)
- /**
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.
*/
- get_card_decal()
C++ Interface: get_card_decal(TextNode self)
- /**
Returns the card_decal flag. See set_card_decal().
*/
- get_card_transformed()
C++ Interface: get_card_transformed(TextNode self)
- /**
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().
*/
- get_class_type()
C++ Interface: get_class_type()
- get_flatten_flags()
C++ Interface: get_flatten_flags(TextNode self)
- /**
Returns the flatten flags. See set_flatten_flags().
*/
- get_frame_actual()
C++ Interface: get_frame_actual(TextNode self)
- /**
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.
*/
- get_frame_as_set()
C++ Interface: get_frame_as_set(TextNode self)
- /**
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.
*/
- get_frame_line_width()
C++ Interface: get_frame_line_width(TextNode self)
- /**
Returns the thickness of the lines that will be used to draw the frame.
*/
- get_height()
C++ Interface: get_height(TextNode self)
- /**
Returns the net height of the text in local 2-d coordinates.
*/
- get_internal_geom()
C++ Interface: get_internal_geom(TextNode self)
- /**
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.
*/
- get_left()
C++ Interface: get_left(TextNode self)
// The following functions return information about the text that was last // built (and is currently visible).
- /**
Returns the leftmost extent of the text in local 2-d coordinates,
unmodified by the set_transform() matrix.
*/
- get_line_height()
C++ Interface: get_line_height(TextNode self)
- /**
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.
*/
- get_lower_right_3d()
C++ Interface: get_lower_right_3d(TextNode self)
- /**
Returns the lower-right extent of the text object, after it has been
transformed into 3-d space by applying the set_transform() matrix.
*/
- get_max_rows()
C++ Interface: get_max_rows(TextNode self)
- /**
Returns the limit on the height of the TextNode specified by
set_max_rows().
*/
- get_num_rows()
C++ Interface: get_num_rows(TextNode self)
- /**
Returns the number of rows of text that were generated. This counts word-
wrapped rows as well as rows generated due to embedded newlines.
*/
- get_right()
C++ Interface: get_right(TextNode self)
- /**
Returns the rightmost extent of the text in local 2-d coordinates,
unmodified by the set_transform() matrix.
*/
- get_top()
C++ Interface: get_top(TextNode self)
- /**
Returns the topmost extent of the text in local 2-d coordinates, unmodified
by the set_transform() matrix.
*/
- get_upper_left_3d()
C++ Interface: get_upper_left_3d(TextNode self)
- /**
Returns the upper-left extent of the text object, after it has been
transformed into 3-d space by applying the set_transform() matrix.
*/
- get_usage_hint()
C++ Interface: get_usage_hint(TextNode self)
- /**
Returns the UsageHint that will be applied to generated geometry. See
set_usage_hint().
*/
- get_width()
C++ Interface: get_width(TextNode self)
- /**
Returns the net width of the text in local 2-d coordinates.
*/
- get_wordwrapped_text()
C++ Interface: get_wordwrapped_text(TextNode self)
// After the text has been set, you can query this to determine how it will // be wordwrapped.
- /**
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.
*/
- get_wordwrapped_wtext()
C++ Interface: get_wordwrapped_wtext(TextNode self)
- /**
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.
*/
- glyph_scale
Returns the scale factor of each letter as specified by set_glyph_scale().
- glyph_shift
Returns the vertical shift of each letter as specified by set_glyph_shift().
- hasCharacter()
C++ Interface: has_character(TextNode self, unicode char 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”.
*/
- hasExactCharacter()
C++ Interface: has_exact_character(TextNode self, unicode char 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().
*/
- hasMaxRows()
C++ Interface: has_max_rows(TextNode self)
- /**
Returns true if a limit on the height of the TextNode has been set via
set_max_rows(), false otherwise.
*/
- hasOverflow()
C++ Interface: has_overflow(TextNode self)
- /**
Returns true if the last text set on the text node exceeded the max_rows
constraint, or false if it all fit.
*/
- has_character()
C++ Interface: has_character(TextNode self, unicode char 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”.
*/
- has_exact_character()
C++ Interface: has_exact_character(TextNode self, unicode char 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().
*/
- has_max_rows()
C++ Interface: has_max_rows(TextNode self)
- /**
Returns true if a limit on the height of the TextNode has been set via
set_max_rows(), false otherwise.
*/
- has_overflow()
C++ Interface: has_overflow(TextNode self)
- /**
Returns true if the last text set on the text node exceeded the max_rows
constraint, or false if it all fit.
*/
- indent
- isCardAsMargin()
C++ Interface: is_card_as_margin(TextNode self)
- /**
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.
*/
- isFrameAsMargin()
C++ Interface: is_frame_as_margin(TextNode self)
- /**
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.
*/
- isWhitespace()
C++ Interface: is_whitespace(TextNode self, unicode char 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.
*/
- is_card_as_margin()
C++ Interface: is_card_as_margin(TextNode self)
- /**
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.
*/
- is_frame_as_margin()
C++ Interface: is_frame_as_margin(TextNode self)
- /**
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.
*/
- is_whitespace()
C++ Interface: is_whitespace(TextNode self, unicode char 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.
*/
- max_rows
- preserve_trailing_whitespace
Returns the preserve_trailing_whitespace flag. See set_preserve_trailing_whitespace().
- setBin()
C++ Interface: set_bin(const TextNode self, str 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”.
*/
- setCardActual()
C++ Interface: set_card_actual(const TextNode self, 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()
C++ Interface: set_card_as_margin(const TextNode self, 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()
C++ Interface: set_card_border(const TextNode self, float size, float uv_portion)
- /**
*/
- setCardColor()
C++ Interface: set_card_color(const TextNode self, const LVecBase4f card_color) set_card_color(const TextNode self, float r, float g, float b, float a)
- setCardDecal()
C++ Interface: set_card_decal(const TextNode self, 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.
*/
- setCoordinateSystem()
C++ Interface: set_coordinate_system(const TextNode self, int cs)
- /**
Specifies the coordinate system in which the text will be generated.
*/
- setDrawOrder()
C++ Interface: set_draw_order(const TextNode self, 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 +
*/
- setFlattenFlags()
C++ Interface: set_flatten_flags(const TextNode self, 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.
*/
- setFont()
C++ Interface: set_font(const TextNode self, TextFont font)
- /**
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().
*/
- setFrameActual()
C++ Interface: set_frame_actual(const TextNode self, 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()
C++ Interface: set_frame_as_margin(const TextNode self, 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()
C++ Interface: set_frame_color(const TextNode self, const LVecBase4f frame_color) set_frame_color(const TextNode self, float r, float g, float b, float a)
- setFrameCorners()
C++ Interface: set_frame_corners(const TextNode self, 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()
C++ Interface: set_frame_line_width(const TextNode self, float line_width)
- /**
Specifies the thickness of the lines that will be used to draw the frame.
*/
- setGlyphScale()
C++ Interface: set_glyph_scale(const TextNode self, 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.
*/
- setGlyphShift()
C++ Interface: set_glyph_shift(const TextNode self, 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.
*/
- setIndent()
C++ Interface: set_indent(const TextNode self, 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.
*/
- setMaxRows()
C++ Interface: set_max_rows(const TextNode self, 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.
*/
- setShadow()
C++ Interface: set_shadow(const TextNode self, const LVecBase2f shadow_offset) set_shadow(const TextNode self, float xoffset, float yoffset)
- setShadowColor()
C++ Interface: set_shadow_color(const TextNode self, const LVecBase4f shadow_color) set_shadow_color(const TextNode self, float r, float g, float b, float a)
- setSmallCaps()
C++ Interface: set_small_caps(const TextNode self, 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().
*/
- setSmallCapsScale()
C++ Interface: set_small_caps_scale(const TextNode self, 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.
*/
- setTabWidth()
C++ Interface: set_tab_width(const TextNode self, 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.
*/
- setTextColor()
C++ Interface: set_text_color(const TextNode self, const LVecBase4f text_color) set_text_color(const TextNode self, float r, float g, float b, float a)
- /**
Sets the color of the text. Note that this will modulate the color of all
components of the text, including the shadow and outline. If you wish to
only set the foreground color, see DynamicTextFont::set_fg().
*/
- /**
Sets the color of the text. Note that this will modulate the color of all
components of the text, including the shadow and outline. If you wish to
only set the foreground color, see DynamicTextFont::set_fg().
*/
- setTransform()
C++ Interface: set_transform(const TextNode self, const LMatrix4f transform)
- /**
Sets an additional transform that is applied to the entire text paragraph.
*/
- setUsageHint()
C++ Interface: set_usage_hint(const TextNode self, int 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()
C++ Interface: set_wordwrap(const TextNode self, 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.
*/
- set_bin()
C++ Interface: set_bin(const TextNode self, str 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”.
*/
- set_card_actual()
C++ Interface: set_card_actual(const TextNode self, 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.
*/
- set_card_as_margin()
C++ Interface: set_card_as_margin(const TextNode self, 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.
*/
- set_card_border()
C++ Interface: set_card_border(const TextNode self, float size, float uv_portion)
- /**
*/
- set_card_color()
C++ Interface: set_card_color(const TextNode self, const LVecBase4f card_color) set_card_color(const TextNode self, float r, float g, float b, float a)
- set_card_decal()
C++ Interface: set_card_decal(const TextNode self, 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.
*/
- set_card_texture()
C++ Interface: set_card_texture(const TextNode self, Texture card_texture)
- /**
*/
- set_coordinate_system()
C++ Interface: set_coordinate_system(const TextNode self, int cs)
- /**
Specifies the coordinate system in which the text will be generated.
*/
- set_draw_order()
C++ Interface: set_draw_order(const TextNode self, 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 +
*/
- set_flatten_flags()
C++ Interface: set_flatten_flags(const TextNode self, 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.
*/
- set_font()
C++ Interface: set_font(const TextNode self, TextFont font)
- /**
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().
*/
- set_frame_actual()
C++ Interface: set_frame_actual(const TextNode self, 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.
*/
- set_frame_as_margin()
C++ Interface: set_frame_as_margin(const TextNode self, 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.
*/
- set_frame_color()
C++ Interface: set_frame_color(const TextNode self, const LVecBase4f frame_color) set_frame_color(const TextNode self, float r, float g, float b, float a)
- set_frame_corners()
C++ Interface: set_frame_corners(const TextNode self, 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.
*/
- set_frame_line_width()
C++ Interface: set_frame_line_width(const TextNode self, float line_width)
- /**
Specifies the thickness of the lines that will be used to draw the frame.
*/
- set_glyph_scale()
C++ Interface: set_glyph_scale(const TextNode self, 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.
*/
- set_glyph_shift()
C++ Interface: set_glyph_shift(const TextNode self, 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.
*/
- set_indent()
C++ Interface: set_indent(const TextNode self, 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.
*/
- set_max_rows()
C++ Interface: set_max_rows(const TextNode self, 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.
*/
- set_shadow()
C++ Interface: set_shadow(const TextNode self, const LVecBase2f shadow_offset) set_shadow(const TextNode self, float xoffset, float yoffset)
- set_shadow_color()
C++ Interface: set_shadow_color(const TextNode self, const LVecBase4f shadow_color) set_shadow_color(const TextNode self, float r, float g, float b, float a)
- set_small_caps()
C++ Interface: set_small_caps(const TextNode self, 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().
*/
- set_small_caps_scale()
C++ Interface: set_small_caps_scale(const TextNode self, 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.
*/
- set_tab_width()
C++ Interface: set_tab_width(const TextNode self, 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.
*/
- set_text_color()
C++ Interface: set_text_color(const TextNode self, const LVecBase4f text_color) set_text_color(const TextNode self, float r, float g, float b, float a)
- /**
Sets the color of the text. Note that this will modulate the color of all
components of the text, including the shadow and outline. If you wish to
only set the foreground color, see DynamicTextFont::set_fg().
*/
- /**
Sets the color of the text. Note that this will modulate the color of all
components of the text, including the shadow and outline. If you wish to
only set the foreground color, see DynamicTextFont::set_fg().
*/
- set_transform()
C++ Interface: set_transform(const TextNode self, const LMatrix4f transform)
- /**
Sets an additional transform that is applied to the entire text paragraph.
*/
- set_usage_hint()
C++ Interface: set_usage_hint(const TextNode self, int 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.
*/
- set_wordwrap()
C++ Interface: set_wordwrap(const TextNode self, 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.
*/
- shadow
Returns the offset of the shadow as set by set_shadow(). It is an error to call this if has_shadow() is false.
- shadow_color
- slant
Returns the factor by which the text is specified to slant to the right.
- small_caps
Returns the small_caps flag. See set_small_caps().
- small_caps_scale
Returns the scale factor applied to lowercase letters from their uppercase equivalents, when the small_caps flag is in effect. See set_small_caps() and set_small_caps_scale().
- tab_width
Returns the width set via set_tab_width().
- text_color
- text_scale
Returns the scale factor of the text as specified by set_text_scale().
- transform
- underscore
Returns the underscore flag. See set_underscore().
- underscore_height
Returns the vertical height of the underscore; see set_underscore_height().
- upcastToPandaNode()
C++ Interface: upcast_to_PandaNode(const TextNode self)
upcast from TextNode to PandaNode
- upcastToTextEncoder()
C++ Interface: upcast_to_TextEncoder(const TextNode self)
upcast from TextNode to TextEncoder
- upcastToTextProperties()
C++ Interface: upcast_to_TextProperties(const TextNode self)
upcast from TextNode to TextProperties
- upcast_to_PandaNode()
C++ Interface: upcast_to_PandaNode(const TextNode self)
upcast from TextNode to PandaNode
- upcast_to_TextEncoder()
C++ Interface: upcast_to_TextEncoder(const TextNode self)
upcast from TextNode to TextEncoder
- upcast_to_TextProperties()
C++ Interface: upcast_to_TextProperties(const TextNode self)
upcast from TextNode to TextProperties
- update()
C++ Interface: update(const TextNode self)
- /**
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.
*/
- usage_hint
- wordwrap