# TextProperties

from pandac.PandaModules import TextProperties

Class : TextProperties
Description : 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:

TextProperties:

## Methods of TextProperties:

TextProperties (Constructor)
addProperties
clear
clearAlign
clearBin
clearDrawOrder
clearFont
clearGlyphScale
clearGlyphShift
clearIndent
clearPreserveTrailingWhitespace
clearShadow
clearShadowColor
clearSlant
clearSmallCaps
clearSmallCapsScale
clearTabWidth
clearTextColor
clearTextScale
clearUnderscore
clearUnderscoreHeight
clearWordwrap
getAlign
getBin
getClassType
getDefaultFont
getDrawOrder
getFont
getGlyphScale
getGlyphShift
getIndent
getPreserveTrailingWhitespace
getShadow
getShadowColor
getSlant
getSmallCaps
getSmallCapsScale
getTabWidth
getTextColor
getTextScale
getUnderscore
getUnderscoreHeight
getWordwrap
hasAlign
hasBin
hasDrawOrder
hasFont
hasGlyphScale
hasGlyphShift
hasIndent
hasPreserveTrailingWhitespace
hasShadow
hasShadowColor
hasSlant
hasSmallCaps
hasSmallCapsScale
hasTabWidth
hasTextColor
hasTextScale
hasUnderscore
hasUnderscoreHeight
hasWordwrap
isAnySpecified
operator !=
operator =
operator ==
setAlign
setBin
setDefaultFont
setDrawOrder
setFont
setGlyphScale
setGlyphShift
setIndent
setPreserveTrailingWhitespace
setShadow
setShadowColor
setSlant
setSmallCaps
setSmallCapsScale
setTabWidth
setTextColor
setTextScale
setUnderscore
setUnderscoreHeight
setWordwrap
write

## Constants in TextProperties:

ALeft | (Alignment)
ARight | (Alignment)
ACenter | (Alignment)
ABoxedLeft | (Alignment)
ABoxedRight | (Alignment)
ABoxedCenter | (Alignment)

TextProperties TextProperties::TextProperties(void); Description:

addProperties void TextProperties::add_properties(TextProperties const &other); Description: Sets any properties that are explicitly specified in other on this object. Leaves other properties unchanged.

clear void TextProperties::clear(void); Description: Unsets all properties that have been specified so far, and resets the TextProperties structure to its initial empty state.

clearAlign void TextProperties::clear_align(void); Description: Restores the default alignment of the text.

clearBin void TextProperties::clear_bin(void); Description: 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.

clearDrawOrder void TextProperties::clear_draw_order(void); Description:

clearFont void TextProperties::clear_font(void); Description: Restores the default font to the text.

clearGlyphScale void TextProperties::clear_glyph_scale(void); Description:

clearGlyphShift void TextProperties::clear_glyph_shift(void); Description:

clearIndent void TextProperties::clear_indent(void); Description: Removes the indent setting from the text. Text will be as wide as it is.

clearPreserveTrailingWhitespace void TextProperties::clear_preserve_trailing_whitespace(void); Description:

clearShadow void TextProperties::clear_shadow(void); Description: Specifies that a shadow will not be drawn behind the text.

clearShadowColor void TextProperties::clear_shadow_color(void); Description: Removes the shadow color specification.

clearSlant void TextProperties::clear_slant(void); Description:

clearSmallCaps void TextProperties::clear_small_caps(void); Description:

clearSmallCapsScale void TextProperties::clear_small_caps_scale(void); Description:

clearTabWidth void TextProperties::clear_tab_width(void); Description:

clearTextColor void TextProperties::clear_text_color(void); Description: Removes the text color specification; the text will be colored whatever it was in the source font file.

clearTextScale void TextProperties::clear_text_scale(void); Description:

clearUnderscore void TextProperties::clear_underscore(void); Description:

clearUnderscoreHeight void TextProperties::clear_underscore_height(void); Description:

clearWordwrap void TextProperties::clear_wordwrap(void); Description: Removes the wordwrap setting from the text. Text will be as wide as it is.

getAlign TextProperties::Alignment TextProperties::get_align(void) const; Description:

getBin string const &TextProperties::get_bin(void) const; Description: Returns the drawing bin set with set_bin(), or empty string if no bin has been set.

getClassType static TypeHandle TextProperties::get_class_type(void); Undocumented function.

getDefaultFont static TextFont *TextProperties::get_default_font(void); Description: Specifies the default font to be used for any TextNode whose font is uninitialized or NULL. See set_font().

getDrawOrder int TextProperties::get_draw_order(void) const; Description: Returns the drawing order set with set_draw_order().

getFont TextFont *TextProperties::get_font(void) const; Description: Returns the font currently in use, if any. If no font is in use, this returns the default font.

getGlyphScale float TextProperties::get_glyph_scale(void) const; Description: Returns the scale factor of each letter as specified by set_glyph_scale().

getGlyphShift float TextProperties::get_glyph_shift(void) const; Description: Returns the vertical shift of each letter as specified by set_glyph_shift().

getIndent float TextProperties::get_indent(void) const; Description:

getPreserveTrailingWhitespace bool TextProperties::get_preserve_trailing_whitespace(void) const; Description: Returns the preserve_trailing_whitespace flag. See set_preserve_trailing_whitespace().

getShadow LVector2f TextProperties::get_shadow(void) const; Description: Returns the offset of the shadow as set by set_shadow(). It is an error to call this if has_shadow() is false.

getShadowColor LVecBase4f TextProperties::get_shadow_color(void) const; Description:

getSlant float TextProperties::get_slant(void) const; Description: Returns the factor by which the text is specified to slant to the right.

getSmallCaps bool TextProperties::get_small_caps(void) const; Description: Returns the small_caps flag. See set_small_caps().

getSmallCapsScale float TextProperties::get_small_caps_scale(void) const; Description: 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 float TextProperties::get_tab_width(void) const; Description: Returns the width set via set_tab_width().

getTextColor LVecBase4f TextProperties::get_text_color(void) const; Description:

getTextScale float TextProperties::get_text_scale(void) const; Description: Returns the scale factor of the text as specified by set_text_scale().

getUnderscore bool TextProperties::get_underscore(void) const; Description: Returns the underscore flag. See set_underscore().

getUnderscoreHeight float TextProperties::get_underscore_height(void) const; Description: Returns the vertical height of the underscore; see set_underscore_height().

getWordwrap float TextProperties::get_wordwrap(void) const; Description:

hasAlign bool TextProperties::has_align(void) const; Description:

hasBin bool TextProperties::has_bin(void) const; Description: Returns true if an explicit drawing bin has been set via set_bin(), false otherwise.

hasDrawOrder bool TextProperties::has_draw_order(void) const; Description:

hasFont bool TextProperties::has_font(void) const; Description:

hasGlyphScale bool TextProperties::has_glyph_scale(void) const; Description:

hasGlyphShift bool TextProperties::has_glyph_shift(void) const; Description:

hasIndent bool TextProperties::has_indent(void) const; Description:

hasPreserveTrailingWhitespace bool TextProperties::has_preserve_trailing_whitespace(void) const; Description:

hasShadow bool TextProperties::has_shadow(void) const; Description:

hasShadowColor bool TextProperties::has_shadow_color(void) const; Description:

hasSlant bool TextProperties::has_slant(void) const; Description:

hasSmallCaps bool TextProperties::has_small_caps(void) const; Description:

hasSmallCapsScale bool TextProperties::has_small_caps_scale(void) const; Description:

hasTabWidth bool TextProperties::has_tab_width(void) const; Description:

hasTextColor bool TextProperties::has_text_color(void) const; Description:

hasTextScale bool TextProperties::has_text_scale(void) const; Description:

hasUnderscore bool TextProperties::has_underscore(void) const; Description:

hasUnderscoreHeight bool TextProperties::has_underscore_height(void) const; Description:

hasWordwrap bool TextProperties::has_wordwrap(void) const; Description:

isAnySpecified bool TextProperties::is_any_specified(void) const; Description: Returns true if any properties have been specified, false otherwise.

operator != bool TextProperties::operator !=(TextProperties const &other) const; Description:

operator = void TextProperties::operator =(TextProperties const &copy); Description:

operator == bool TextProperties::operator ==(TextProperties const &other) const; Description:

setAlign void TextProperties::set_align(TextProperties::Alignment align_type); Description: Specifies the alignment of the text within its margins.

setBin void TextProperties::set_bin(string const &bin); Description: 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 static void TextProperties::set_default_font(TextFont *); Description: Specifies the default font to be used for any TextNode whose font is uninitialized or NULL. See set_font().

setDrawOrder int TextProperties::set_draw_order(int draw_order); Description: 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 + 3.

setFont void TextProperties::set_font(TextFont *font); Description: 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 void TextProperties::set_glyph_scale(float glyph_scale); Description: 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 void TextProperties::set_glyph_shift(float glyph_shift); Description: 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 void TextProperties::set_indent(float indent); Description: 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 void TextProperties::set_preserve_trailing_whitespace(bool preserve_trailing_whitespace); Description: 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 void TextProperties::set_shadow(float xoffset, float yoffset); Description: 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 void TextProperties::set_shadow_color(float r, float g, float b, float a); Description:

setSlant void TextProperties::set_slant(float slant); Description: Specifies the factor by which the text slants to the right.

setSmallCaps void TextProperties::set_small_caps(bool small_caps); Description: 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 void TextProperties::set_small_caps_scale(float small_caps_scale); Description: 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 void TextProperties::set_tab_width(float tab_width); Description: 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 void TextProperties::set_text_color(float r, float g, float b, float a); Description:

setTextScale void TextProperties::set_text_scale(float text_scale); Description: 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 void TextProperties::set_underscore(bool underscore); Description: 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 void TextProperties::set_underscore_height(float underscore_height); Description: 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 void TextProperties::set_wordwrap(float wordwrap); Description: 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.

write void TextProperties::write(ostream &out, int indent_level = (0)) const; Description: