TextProperties
from panda3d.core import TextProperties
- class TextProperties
Bases:
DTOOL_SUPER_BASE
This defines the set of visual properties that may be assigned to the individual characters of the text. (Properties which affect the overall block of text can only be specified on the TextNode directly).
Typically, there is just one set of properties on a given block of text, which is set directly on the TextNode (TextNode inherits from TextProperties). That makes all of the text within a particular block have the same appearance.
This separate class exists in order to implement multiple different kinds of text appearing within one block. The text string itself may reference a TextProperties structure by name using the 1 and 2 tokens embedded within the string; each nested TextProperties structure modifies the appearance of subsequent text within the block.
Inheritance diagram
- ABoxedCenter = 5
- ABoxedLeft = 3
- ABoxedRight = 4
- ACenter = 2
- ALeft = 0
- ARight = 1
- A_boxed_center = 5
- A_boxed_left = 3
- A_boxed_right = 4
- A_center = 2
- A_left = 0
- A_right = 1
- DLtr = 0
- DRtl = 1
- D_ltr = 0
- D_rtl = 1
- __init__(*args, **kwargs)
- addProperties()
C++ Interface: add_properties(const TextProperties self, const TextProperties other)
- /**
Sets any properties that are explicitly specified in other on this object.
Leaves other properties unchanged.
*/
- add_properties()
C++ Interface: add_properties(const TextProperties self, const TextProperties other)
- /**
Sets any properties that are explicitly specified in other on this object.
Leaves other properties unchanged.
*/
- align
- assign()
C++ Interface: assign(const TextProperties self, const TextProperties copy)
- bin
- clear()
C++ Interface: clear(const TextProperties self)
- /**
Unsets all properties that have been specified so far, and resets the
TextProperties structure to its initial empty state.
*/
- clearAlign()
C++ Interface: clear_align(const TextProperties self)
- /**
Restores the default alignment of the text.
*/
- clearBin()
C++ Interface: clear_bin(const TextProperties 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.
*/
- clearDirection()
C++ Interface: clear_direction(const TextProperties self)
- /**
Clears the text direction setting. If no text direction is specified, it
will be guessed based on the contents of the string.
@since 1.10.0
*/
- clearFont()
C++ Interface: clear_font(const TextProperties self)
- /**
Restores the default font to the text.
*/
- clearIndent()
C++ Interface: clear_indent(const TextProperties self)
- /**
Removes the indent setting from the text. Text will be as wide as it is.
*/
- clearPreserveTrailingWhitespace()
C++ Interface: clear_preserve_trailing_whitespace(const TextProperties self)
- /**
*/
- clearShadow()
C++ Interface: clear_shadow(const TextProperties self)
- /**
Specifies that a shadow will not be drawn behind the text.
*/
- clearShadowColor()
C++ Interface: clear_shadow_color(const TextProperties self)
- /**
Removes the shadow color specification.
*/
- clearTextColor()
C++ Interface: clear_text_color(const TextProperties 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 TextProperties self)
- /**
Removes the wordwrap setting from the text. Text will be as wide as it is.
*/
- clear_align()
C++ Interface: clear_align(const TextProperties self)
- /**
Restores the default alignment of the text.
*/
- clear_bin()
C++ Interface: clear_bin(const TextProperties 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_direction()
C++ Interface: clear_direction(const TextProperties self)
- /**
Clears the text direction setting. If no text direction is specified, it
will be guessed based on the contents of the string.
@since 1.10.0
*/
- clear_font()
C++ Interface: clear_font(const TextProperties self)
- /**
Restores the default font to the text.
*/
- clear_indent()
C++ Interface: clear_indent(const TextProperties self)
- /**
Removes the indent setting from the text. Text will be as wide as it is.
*/
- clear_preserve_trailing_whitespace()
C++ Interface: clear_preserve_trailing_whitespace(const TextProperties self)
- /**
*/
- clear_shadow()
C++ Interface: clear_shadow(const TextProperties self)
- /**
Specifies that a shadow will not be drawn behind the text.
*/
- clear_shadow_color()
C++ Interface: clear_shadow_color(const TextProperties self)
- /**
Removes the shadow color specification.
*/
- clear_text_color()
C++ Interface: clear_text_color(const TextProperties 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 TextProperties self)
- /**
Removes the wordwrap setting from the text. Text will be as wide as it is.
*/
- direction
- draw_order
- font
- getBin()
C++ Interface: get_bin(TextProperties self)
- /**
Returns the drawing bin set with set_bin(), or empty string if no bin has
been set.
*/
- getClassType()
C++ Interface: get_class_type()
- getDefaultFont()
C++ Interface: get_default_font()
- /**
Specifies the default font to be used for any TextNode whose font is
uninitialized or NULL. See set_font().
*/
- getDirection()
C++ Interface: get_direction(TextProperties self)
- /**
Returns the direction of the text as specified by set_direction().
@since 1.10.0
*/
- getDrawOrder()
C++ Interface: get_draw_order(TextProperties self)
- /**
Returns the drawing order set with set_draw_order().
*/
- getFont()
C++ Interface: get_font(TextProperties self)
- /**
Returns the font currently in use, if any. If no font is in use, this
returns the default font.
*/
- getGlyphScale()
C++ Interface: get_glyph_scale(TextProperties self)
- /**
Returns the scale factor of each letter as specified by set_glyph_scale().
*/
- getGlyphShift()
C++ Interface: get_glyph_shift(TextProperties self)
- /**
Returns the vertical shift of each letter as specified by
set_glyph_shift().
*/
- getPreserveTrailingWhitespace()
C++ Interface: get_preserve_trailing_whitespace(TextProperties self)
- /**
Returns the preserve_trailing_whitespace flag. See
set_preserve_trailing_whitespace().
*/
- getShadow()
C++ Interface: get_shadow(TextProperties self)
- /**
Returns the offset of the shadow as set by set_shadow(). It is an error to
call this if has_shadow() is false.
*/
- getSlant()
C++ Interface: get_slant(TextProperties self)
- /**
Returns the factor by which the text is specified to slant to the right.
*/
- getSmallCaps()
C++ Interface: get_small_caps(TextProperties self)
- /**
Returns the small_caps flag. See set_small_caps().
*/
- getSmallCapsScale()
C++ Interface: get_small_caps_scale(TextProperties self)
- /**
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().
*/
- getTabWidth()
C++ Interface: get_tab_width(TextProperties self)
- /**
Returns the width set via set_tab_width().
*/
- getTextScale()
C++ Interface: get_text_scale(TextProperties self)
- /**
Returns the scale factor of the text as specified by set_text_scale().
*/
- getUnderscore()
C++ Interface: get_underscore(TextProperties self)
- /**
Returns the underscore flag. See set_underscore().
*/
- getUnderscoreHeight()
C++ Interface: get_underscore_height(TextProperties self)
- /**
Returns the vertical height of the underscore; see set_underscore_height().
*/
- get_bin()
C++ Interface: get_bin(TextProperties self)
- /**
Returns the drawing bin set with set_bin(), or empty string if no bin has
been set.
*/
- get_class_type()
C++ Interface: get_class_type()
- get_default_font()
C++ Interface: get_default_font()
- /**
Specifies the default font to be used for any TextNode whose font is
uninitialized or NULL. See set_font().
*/
- get_direction()
C++ Interface: get_direction(TextProperties self)
- /**
Returns the direction of the text as specified by set_direction().
@since 1.10.0
*/
- get_draw_order()
C++ Interface: get_draw_order(TextProperties self)
- /**
Returns the drawing order set with set_draw_order().
*/
- get_font()
C++ Interface: get_font(TextProperties self)
- /**
Returns the font currently in use, if any. If no font is in use, this
returns the default font.
*/
- get_glyph_scale()
C++ Interface: get_glyph_scale(TextProperties self)
- /**
Returns the scale factor of each letter as specified by set_glyph_scale().
*/
- get_glyph_shift()
C++ Interface: get_glyph_shift(TextProperties self)
- /**
Returns the vertical shift of each letter as specified by
set_glyph_shift().
*/
- get_preserve_trailing_whitespace()
C++ Interface: get_preserve_trailing_whitespace(TextProperties self)
- /**
Returns the preserve_trailing_whitespace flag. See
set_preserve_trailing_whitespace().
*/
- get_shadow()
C++ Interface: get_shadow(TextProperties self)
- /**
Returns the offset of the shadow as set by set_shadow(). It is an error to
call this if has_shadow() is false.
*/
- get_slant()
C++ Interface: get_slant(TextProperties self)
- /**
Returns the factor by which the text is specified to slant to the right.
*/
- get_small_caps()
C++ Interface: get_small_caps(TextProperties self)
- /**
Returns the small_caps flag. See set_small_caps().
*/
- get_small_caps_scale()
C++ Interface: get_small_caps_scale(TextProperties self)
- /**
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().
*/
- get_tab_width()
C++ Interface: get_tab_width(TextProperties self)
- /**
Returns the width set via set_tab_width().
*/
- get_text_scale()
C++ Interface: get_text_scale(TextProperties self)
- /**
Returns the scale factor of the text as specified by set_text_scale().
*/
- get_underscore()
C++ Interface: get_underscore(TextProperties self)
- /**
Returns the underscore flag. See set_underscore().
*/
- get_underscore_height()
C++ Interface: get_underscore_height(TextProperties self)
- /**
Returns the vertical height of the underscore; see set_underscore_height().
*/
- glyph_scale
- glyph_shift
- hasBin()
C++ Interface: has_bin(TextProperties self)
- /**
Returns true if an explicit drawing bin has been set via set_bin(), false
otherwise.
*/
- hasPreserveTrailingWhitespace()
C++ Interface: has_preserve_trailing_whitespace(TextProperties self)
- /**
*/
- hasTextColor()
C++ Interface: has_text_color(TextProperties self)
- /**
Returns true if a text color was specified with set_text_color().
*/
- has_bin()
C++ Interface: has_bin(TextProperties self)
- /**
Returns true if an explicit drawing bin has been set via set_bin(), false
otherwise.
*/
- has_preserve_trailing_whitespace()
C++ Interface: has_preserve_trailing_whitespace(TextProperties self)
- /**
*/
- has_text_color()
C++ Interface: has_text_color(TextProperties self)
- /**
Returns true if a text color was specified with set_text_color().
*/
- indent
- isAnySpecified()
C++ Interface: is_any_specified(TextProperties self)
- /**
Returns true if any properties have been specified, false otherwise.
*/
- is_any_specified()
C++ Interface: is_any_specified(TextProperties self)
- /**
Returns true if any properties have been specified, false otherwise.
*/
- preserve_trailing_whitespace
- setAlign()
C++ Interface: set_align(const TextProperties self, int align_type)
- /**
Specifies the alignment of the text within its margins.
*/
- setBin()
C++ Interface: set_bin(const TextProperties self, str bin)
- /**
Names the CullBin that the text geometry should be assigned to. If this is
set, then a CullBinAttrib will be created to explicitly place each
component in the named bin.
The draw_order value will also be passed to each CullBinAttrib as
appropriate; this is particularly useful if this names a CullBinFixed, e.g.
“fixed”.
*/
- setDefaultFont()
C++ Interface: set_default_font(TextFont param0)
- /**
Specifies the default font to be used for any TextNode whose font is
uninitialized or NULL. See set_font().
*/
- setDirection()
C++ Interface: set_direction(const TextProperties self, int direction)
- /**
Specifies the text direction. If none is specified, it will be guessed
based on the contents of the string.
@since 1.10.0
*/
- setDrawOrder()
C++ Interface: set_draw_order(const TextProperties self, int draw_order)
- /**
Sets the drawing order of text created by the TextNode. 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 nodes 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 +
*/
- setFont()
C++ Interface: set_font(const TextProperties 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().
*/
- setGlyphScale()
C++ Interface: set_glyph_scale(const TextProperties self, float glyph_scale)
- /**
Specifies the factor by which to scale each letter of the text as it is
placed, in addition to any scales inherited from the node or from
set_text_scale(). This can be used (possibly in conjunction with
set_glyph_shift()) to implement superscripting or subscripting.
The glyph scale is cumulative when applied to nested TextProperties. It is
intended primarily for implementing superscripts, not for scaling the text
in general. See also set_text_scale(), which is intended primarily for
scaling the text in general, and is not cumulative.
*/
- setGlyphShift()
C++ Interface: set_glyph_shift(const TextProperties 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 TextProperties 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.
*/
- setPreserveTrailingWhitespace()
C++ Interface: set_preserve_trailing_whitespace(const TextProperties self, bool preserve_trailing_whitespace)
- /**
Sets the preserve_trailing_whitespace flag. When this is set, trailing
whitespace at the end of the line is not stripped when the text is
wordwrapped (it is stripped by default). Since the trailing whitespace is
invisible, this is important primarily for determining the proper width of
a frame or card behind the text.
*/
- setShadow()
C++ Interface: set_shadow(const TextProperties self, const LVecBase2f shadow_offset) set_shadow(const TextProperties self, float xoffset, float yoffset)
- setShadowColor()
C++ Interface: set_shadow_color(const TextProperties self, const LVecBase4f shadow_color) set_shadow_color(const TextProperties self, float r, float g, float b, float a)
- setSlant()
C++ Interface: set_slant(const TextProperties self, float slant)
- /**
Specifies the factor by which the text slants to the right.
*/
- setSmallCaps()
C++ Interface: set_small_caps(const TextProperties 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 TextProperties 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 TextProperties 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 TextProperties self, const LVecBase4f text_color) set_text_color(const TextProperties 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().
*/
- setTextScale()
C++ Interface: set_text_scale(const TextProperties self, float text_scale)
- /**
Specifies the factor by which to scale the text, in addition to any
scalings imposed by the node, as well as in addition to the glyph scale.
The text scale is not cumulative when applied to nested TextProperties.
See also set_glyph_scale(), which is cumulative.
*/
- setUnderscore()
C++ Interface: set_underscore(const TextProperties self, bool underscore)
- /**
Sets the underscore flag. When this is set, the text is underscored with a
one-pixel line the same color as the text foreground, drawn at the
baseline.
*/
- setUnderscoreHeight()
C++ Interface: set_underscore_height(const TextProperties self, float underscore_height)
- /**
Specifies the vertical height of the underscore, relative to the text
baseline. This only has meaning if the underscore mode is enabled with
set_underscore().
*/
- setWordwrap()
C++ Interface: set_wordwrap(const TextProperties 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_align()
C++ Interface: set_align(const TextProperties self, int align_type)
- /**
Specifies the alignment of the text within its margins.
*/
- set_bin()
C++ Interface: set_bin(const TextProperties self, str bin)
- /**
Names the CullBin that the text geometry should be assigned to. If this is
set, then a CullBinAttrib will be created to explicitly place each
component in the named bin.
The draw_order value will also be passed to each CullBinAttrib as
appropriate; this is particularly useful if this names a CullBinFixed, e.g.
“fixed”.
*/
- set_default_font()
C++ Interface: set_default_font(TextFont param0)
- /**
Specifies the default font to be used for any TextNode whose font is
uninitialized or NULL. See set_font().
*/
- set_direction()
C++ Interface: set_direction(const TextProperties self, int direction)
- /**
Specifies the text direction. If none is specified, it will be guessed
based on the contents of the string.
@since 1.10.0
*/
- set_draw_order()
C++ Interface: set_draw_order(const TextProperties self, int draw_order)
- /**
Sets the drawing order of text created by the TextNode. 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 nodes 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_font()
C++ Interface: set_font(const TextProperties 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_glyph_scale()
C++ Interface: set_glyph_scale(const TextProperties self, float glyph_scale)
- /**
Specifies the factor by which to scale each letter of the text as it is
placed, in addition to any scales inherited from the node or from
set_text_scale(). This can be used (possibly in conjunction with
set_glyph_shift()) to implement superscripting or subscripting.
The glyph scale is cumulative when applied to nested TextProperties. It is
intended primarily for implementing superscripts, not for scaling the text
in general. See also set_text_scale(), which is intended primarily for
scaling the text in general, and is not cumulative.
*/
- set_glyph_shift()
C++ Interface: set_glyph_shift(const TextProperties 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 TextProperties 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_preserve_trailing_whitespace()
C++ Interface: set_preserve_trailing_whitespace(const TextProperties self, bool preserve_trailing_whitespace)
- /**
Sets the preserve_trailing_whitespace flag. When this is set, trailing
whitespace at the end of the line is not stripped when the text is
wordwrapped (it is stripped by default). Since the trailing whitespace is
invisible, this is important primarily for determining the proper width of
a frame or card behind the text.
*/
- set_shadow()
C++ Interface: set_shadow(const TextProperties self, const LVecBase2f shadow_offset) set_shadow(const TextProperties self, float xoffset, float yoffset)
- set_shadow_color()
C++ Interface: set_shadow_color(const TextProperties self, const LVecBase4f shadow_color) set_shadow_color(const TextProperties self, float r, float g, float b, float a)
- set_slant()
C++ Interface: set_slant(const TextProperties self, float slant)
- /**
Specifies the factor by which the text slants to the right.
*/
- set_small_caps()
C++ Interface: set_small_caps(const TextProperties 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 TextProperties 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 TextProperties 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 TextProperties self, const LVecBase4f text_color) set_text_color(const TextProperties 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_text_scale()
C++ Interface: set_text_scale(const TextProperties self, float text_scale)
- /**
Specifies the factor by which to scale the text, in addition to any
scalings imposed by the node, as well as in addition to the glyph scale.
The text scale is not cumulative when applied to nested TextProperties.
See also set_glyph_scale(), which is cumulative.
*/
- set_underscore()
C++ Interface: set_underscore(const TextProperties self, bool underscore)
- /**
Sets the underscore flag. When this is set, the text is underscored with a
one-pixel line the same color as the text foreground, drawn at the
baseline.
*/
- set_underscore_height()
C++ Interface: set_underscore_height(const TextProperties self, float underscore_height)
- /**
Specifies the vertical height of the underscore, relative to the text
baseline. This only has meaning if the underscore mode is enabled with
set_underscore().
*/
- set_wordwrap()
C++ Interface: set_wordwrap(const TextProperties 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
- shadow_color
- slant
- small_caps
- small_caps_scale
- tab_width
- text_color
- text_scale
- underscore
- underscore_height
- wordwrap