41class EXPCL_PANDA_TEXT TextProperties {
58 TextProperties(
const TextProperties ©);
59 void operator = (
const TextProperties ©);
61 bool operator == (
const TextProperties &other)
const;
62 INLINE
bool operator != (
const TextProperties &other)
const;
72 INLINE
bool has_font()
const;
76 INLINE
void clear_small_caps();
77 INLINE
bool has_small_caps()
const;
81 INLINE
void clear_small_caps_scale();
82 INLINE
bool has_small_caps_scale()
const;
86 INLINE
void clear_slant();
87 INLINE
bool has_slant()
const;
91 INLINE
void clear_underscore();
92 INLINE
bool has_underscore()
const;
96 INLINE
void clear_underscore_height();
97 INLINE
bool has_underscore_height()
const;
100 INLINE
void set_align(Alignment align_type);
102 INLINE
bool has_align()
const;
103 INLINE Alignment get_align()
const;
107 INLINE
bool has_indent()
const;
108 INLINE PN_stdfloat get_indent()
const;
112 INLINE
bool has_wordwrap()
const;
113 INLINE PN_stdfloat get_wordwrap()
const;
116 INLINE
void clear_preserve_trailing_whitespace();
117 INLINE
bool has_preserve_trailing_whitespace()
const;
120 INLINE
void set_text_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a);
124 INLINE LColor get_text_color()
const;
126 INLINE
void set_shadow_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a);
127 INLINE
void set_shadow_color(
const LColor &shadow_color);
129 INLINE
bool has_shadow_color()
const;
130 INLINE LColor get_shadow_color()
const;
132 INLINE
void set_shadow(PN_stdfloat xoffset, PN_stdfloat yoffset);
133 INLINE
void set_shadow(
const LVecBase2 &shadow_offset);
135 INLINE
bool has_shadow()
const;
138 INLINE
void set_bin(
const std::string &bin);
141 INLINE
const std::string &
get_bin()
const;
144 INLINE
void clear_draw_order();
145 INLINE
bool has_draw_order()
const;
149 INLINE
void clear_tab_width();
150 INLINE
bool has_tab_width()
const;
154 INLINE
void clear_glyph_scale();
155 INLINE
bool has_glyph_scale()
const;
159 INLINE
void clear_glyph_shift();
160 INLINE
bool has_glyph_shift()
const;
164 INLINE
void clear_text_scale();
165 INLINE
bool has_text_scale()
const;
175 void write(std::ostream &out,
int indent_level = 0)
const;
191 MAKE_PROPERTY2(preserve_trailing_whitespace,
196 MAKE_PROPERTY2(shadow_color, has_shadow_color, get_shadow_color,
218 static void load_default_font();
221 F_has_font = 0x00000001,
222 F_has_small_caps = 0x00000002,
223 F_has_small_caps_scale = 0x00000004,
224 F_has_slant = 0x00000008,
225 F_has_align = 0x00000010,
226 F_has_indent = 0x00000020,
227 F_has_wordwrap = 0x00000040,
228 F_has_preserve_trailing_whitespace = 0x00000080,
229 F_has_text_color = 0x00000100,
230 F_has_shadow_color = 0x00000200,
231 F_has_shadow = 0x00000400,
232 F_has_bin = 0x00000800,
233 F_has_draw_order = 0x00001000,
234 F_has_tab_width = 0x00002000,
235 F_has_glyph_scale = 0x00004000,
236 F_has_glyph_shift = 0x00008000,
237 F_has_underscore = 0x00010000,
238 F_has_underscore_height = 0x00020000,
239 F_has_text_scale = 0x00040000,
240 F_has_direction = 0x00080000,
247 PN_stdfloat _small_caps_scale;
250 PN_stdfloat _underscore_height;
252 PN_stdfloat _indent_width;
253 PN_stdfloat _wordwrap_width;
254 bool _preserve_trailing_whitespace;
256 LColor _shadow_color;
257 LVector2 _shadow_offset;
260 PN_stdfloat _tab_width;
261 PN_stdfloat _glyph_scale;
262 PN_stdfloat _glyph_shift;
263 PN_stdfloat _text_scale;
264 Direction _direction;
270 static bool _loaded_default_font;
276 static void init_type() {
281 static TypeHandle _type_handle;
An encapsulation of a font; i.e.
set_glyph_shift
Specifies a vertical amount to shift each letter of the text as it is placed.
const RenderState * get_shadow_state() const
Returns a RenderState object suitable for rendering the shadow of this text with these properties.
set_underscore_height
Specifies the vertical height of the underscore, relative to the text baseline.
get_slant
Returns the factor by which the text is specified to slant to the right.
set_shadow
Specifies that the text should be drawn with a shadow, by creating a second copy of the text and offs...
get_draw_order
Returns the drawing order set with set_draw_order().
set_align
Specifies the alignment of the text within its margins.
clear_bin
Removes the effect of a previous call to set_bin().
get_underscore_height
Returns the vertical height of the underscore; see set_underscore_height().
get_glyph_shift
Returns the vertical shift of each letter as specified by set_glyph_shift().
has_text_color
Returns true if a text color was specified with set_text_color().
clear_shadow
Specifies that a shadow will not be drawn behind the text.
const RenderState * get_text_state() const
Returns a RenderState object suitable for rendering text with these properties.
set_draw_order
Sets the drawing order of text created by the TextNode.
set_wordwrap
Sets the text up to automatically wordwrap when it exceeds the indicated width.
get_preserve_trailing_whitespace
Returns the preserve_trailing_whitespace flag.
get_glyph_scale
Returns the scale factor of each letter as specified by set_glyph_scale().
set_font
Sets the font that will be used when making text.
set_small_caps_scale
Sets the scale factor applied to lowercase letters from their uppercase equivalents,...
set_tab_width
Sets the width of each tab stop, in screen units.
get_shadow
Returns the offset of the shadow as set by set_shadow().
get_bin
Returns the drawing bin set with set_bin(), or empty string if no bin has been set.
clear_text_color
Removes the text color specification; the text will be colored whatever it was in the source font fil...
set_glyph_scale
Specifies the factor by which to scale each letter of the text as it is placed, in addition to any sc...
get_font
Returns the font currently in use, if any.
get_small_caps_scale
Returns the scale factor applied to lowercase letters from their uppercase equivalents,...
bool is_any_specified() const
Returns true if any properties have been specified, false otherwise.
set_indent
Specifies the amount of extra space that is inserted before the first character of each line.
static void set_default_font(TextFont *)
Specifies the default font to be used for any TextNode whose font is uninitialized or NULL.
get_direction
Returns the direction of the text as specified by set_direction().
void add_properties(const TextProperties &other)
Sets any properties that are explicitly specified in other on this object.
void clear()
Unsets all properties that have been specified so far, and resets the TextProperties structure to its...
has_bin
Returns true if an explicit drawing bin has been set via set_bin(), false otherwise.
set_preserve_trailing_whitespace
Sets the preserve_trailing_whitespace flag.
static TextFont * get_default_font()
Specifies the default font to be used for any TextNode whose font is uninitialized or NULL.
set_text_scale
Specifies the factor by which to scale the text, in addition to any scalings imposed by the node,...
get_text_scale
Returns the scale factor of the text as specified by set_text_scale().
set_slant
Specifies the factor by which the text slants to the right.
set_bin
Names the CullBin that the text geometry should be assigned to.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.