46 invalidate_with_measure();
58 invalidate_with_measure();
93 return (_flags & F_has_overflow) != 0;
101 INLINE
void TextNode::
102 set_frame_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) {
103 set_frame_color(
LColor(r, g, b, a));
111 INLINE
void TextNode::
112 set_frame_color(
const LColor &frame_color) {
113 if (_frame_color != frame_color) {
114 _frame_color = frame_color;
115 invalidate_no_measure();
125 get_frame_color()
const {
134 INLINE
void TextNode::
135 set_card_border(PN_stdfloat size, PN_stdfloat uv_portion) {
136 if (!has_card_border() || _card_border_size != size || _card_border_uv_portion != uv_portion) {
137 _flags |= F_has_card_border;
138 _card_border_size = size;
139 _card_border_uv_portion = uv_portion;
140 invalidate_no_measure();
149 INLINE
void TextNode::
150 clear_card_border() {
151 if (has_card_border()) {
152 _flags &= ~F_has_card_border;
153 invalidate_no_measure();
162 INLINE PN_stdfloat TextNode::
163 get_card_border_size()
const {
164 return _card_border_size;
172 INLINE PN_stdfloat TextNode::
173 get_card_border_uv_portion()
const {
174 return _card_border_uv_portion;
182 INLINE
bool TextNode::
183 has_card_border()
const {
184 return (_flags & F_has_card_border) != 0;
192 INLINE
void TextNode::
193 set_card_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) {
194 set_card_color(
LColor(r, g, b, a));
202 INLINE
void TextNode::
203 set_card_color(
const LColor &card_color) {
204 if (_card_color != card_color) {
205 _card_color = card_color;
206 invalidate_no_measure();
216 get_card_color()
const {
225 INLINE
void TextNode::
226 set_card_texture(
Texture *card_texture) {
227 if (card_texture == (
Texture *)NULL) {
228 clear_card_texture();
230 if (!has_card_texture() || _card_texture != card_texture) {
231 _flags |= F_has_card_texture;
232 _card_texture = card_texture;
233 invalidate_no_measure();
243 INLINE
void TextNode::
244 clear_card_texture() {
245 if (has_card_texture()) {
246 _flags &= ~F_has_card_texture;
247 _card_texture = NULL;
248 invalidate_no_measure();
257 INLINE
bool TextNode::
258 has_card_texture()
const {
259 return (_flags & F_has_card_texture) != 0;
268 get_card_texture()
const {
269 return _card_texture;
283 _flags |= (F_has_frame | F_frame_as_margin);
284 _frame_ul.set(left, top);
285 _frame_lr.set(right, bottom);
286 invalidate_no_measure();
300 set_frame_actual(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) {
301 _flags |= F_has_frame;
302 _flags &= ~F_frame_as_margin;
303 _frame_ul.set(left, top);
304 _frame_lr.set(right, bottom);
305 invalidate_no_measure();
316 _flags &= ~F_has_frame;
317 invalidate_no_measure();
325 INLINE
bool TextNode::
327 return (_flags & F_has_frame) != 0;
343 nassertr(has_frame(),
false);
344 return (_flags & F_frame_as_margin) != 0;
358 nassertr(has_frame(),
LVecBase4(0.0, 0.0, 0.0, 0.0));
359 return LVecBase4(_frame_ul[0], _frame_lr[0], _frame_lr[1], _frame_ul[1]);
380 return LVecBase4(_text_ul[0], _text_lr[0], _text_lr[1], _text_ul[1]);
384 return LVecBase4(_text_ul[0] - _frame_ul[0],
385 _text_lr[0] + _frame_lr[0],
386 _text_lr[1] - _frame_lr[1],
387 _text_ul[1] + _frame_ul[1]);
401 _frame_width = frame_width;
402 invalidate_no_measure();
427 _flags |= F_frame_corners;
429 _flags &= ~F_frame_corners;
431 invalidate_no_measure();
439 INLINE
bool TextNode::
440 get_frame_corners()
const {
441 return (_flags & F_frame_corners) != 0;
456 _flags |= (F_has_card | F_card_as_margin);
457 _card_ul.set(left, top);
458 _card_lr.set(right, bottom);
459 invalidate_no_measure();
473 set_card_actual(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) {
474 _flags |= F_has_card;
475 _flags &= ~F_card_as_margin;
476 _card_ul.set(left, top);
477 _card_lr.set(right, bottom);
478 invalidate_no_measure();
492 _flags |= F_card_decal;
494 _flags &= ~F_card_decal;
496 invalidate_no_measure();
507 _flags &= ~F_has_card;
508 invalidate_no_measure();
516 INLINE
bool TextNode::
518 return (_flags & F_has_card) != 0;
528 return (_flags & F_card_decal) != 0;
544 nassertr(has_card(),
false);
545 return (_flags & F_card_as_margin) != 0;
559 nassertr(has_card(),
LVecBase4(0.0, 0.0, 0.0, 0.0));
560 return LVecBase4(_card_ul[0], _card_lr[0], _card_lr[1], _card_ul[1]);
581 return LVecBase4(_text_ul[0], _text_lr[0], _text_lr[1], _text_ul[1]);
585 return LVecBase4(_text_ul[0] - _card_ul[0],
586 _text_lr[0] + _card_lr[0],
587 _text_lr[1] - _card_lr[1],
588 _text_ul[1] + _card_ul[1]);
609 return LVecBase4(ul[0], lr[0], lr[2], ul[2]);
620 _transform = transform;
621 invalidate_with_measure();
630 get_transform()
const {
642 _coordinate_system = coordinate_system;
643 invalidate_with_measure();
651 INLINE CoordinateSystem TextNode::
652 get_coordinate_system()
const {
653 return _coordinate_system;
668 _usage_hint = usage_hint;
669 invalidate_no_measure();
729 _flatten_flags = flatten_flags;
739 return _flatten_flags;
752 invalidate_with_measure();
763 invalidate_with_measure();
790 invalidate_with_measure();
798 INLINE
void TextNode::
800 TextProperties::clear_small_caps();
801 invalidate_with_measure();
815 invalidate_with_measure();
823 INLINE
void TextNode::
824 clear_small_caps_scale() {
825 TextProperties::clear_small_caps_scale();
826 invalidate_with_measure();
834 INLINE
void TextNode::
835 set_slant(PN_stdfloat slant) {
837 invalidate_with_measure();
845 INLINE
void TextNode::
847 TextProperties::clear_slant();
848 invalidate_with_measure();
856 INLINE
void TextNode::
857 set_align(TextNode::Alignment align_type) {
859 invalidate_with_measure();
867 INLINE
void TextNode::
870 invalidate_with_measure();
883 invalidate_with_measure();
891 INLINE
void TextNode::
894 invalidate_with_measure();
907 invalidate_with_measure();
919 invalidate_with_measure();
927 INLINE
void TextNode::
928 set_text_color(
const LColor &text_color) {
929 TextProperties::set_text_color(text_color);
930 invalidate_no_measure();
938 INLINE
void TextNode::
939 set_text_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) {
940 set_text_color(
LColor(r, g, b, a));
952 invalidate_no_measure();
960 INLINE
void TextNode::
961 set_shadow_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) {
962 set_shadow_color(
LColor(r, g, b, a));
970 INLINE
void TextNode::
971 set_shadow_color(
const LColor &shadow_color) {
972 TextProperties::set_shadow_color(shadow_color);
973 invalidate_no_measure();
981 INLINE
void TextNode::
982 clear_shadow_color() {
984 invalidate_with_measure();
1009 invalidate_no_measure();
1021 invalidate_no_measure();
1040 invalidate_no_measure();
1054 invalidate_no_measure();
1074 invalidate_no_measure();
1083 INLINE
void TextNode::
1084 clear_draw_order() {
1085 TextProperties::clear_draw_order();
1086 invalidate_with_measure();
1099 invalidate_with_measure();
1107 INLINE
void TextNode::
1109 TextProperties::clear_tab_width();
1110 invalidate_with_measure();
1124 invalidate_with_measure();
1132 INLINE
void TextNode::
1133 clear_glyph_scale() {
1134 TextProperties::clear_glyph_scale();
1135 invalidate_with_measure();
1149 invalidate_with_measure();
1157 INLINE
void TextNode::
1158 clear_glyph_shift() {
1159 TextProperties::clear_glyph_shift();
1160 invalidate_with_measure();
1173 invalidate_with_measure();
1187 set_text(
const string &text, TextNode::Encoding encoding) {
1189 invalidate_with_measure();
1200 invalidate_with_measure();
1212 invalidate_with_measure();
1225 invalidate_with_measure();
1266 invalidate_with_measure();
1278 invalidate_with_measure();
1294 return _wordwrapped_wtext;
1358 return _text_ul[1] - _text_lr[1];
1370 return _text_lr[0] - _text_ul[0];
1436 invalidate_with_measure();
1449 INLINE
void TextNode::
1450 invalidate_no_measure() {
1451 _flags |= F_needs_rebuild;
1463 INLINE
void TextNode::
1464 invalidate_with_measure() {
1465 _flags |= (F_needs_rebuild | F_needs_measure);
1466 mark_internal_bounds_stale();
1476 INLINE
void TextNode::
1477 check_rebuild()
const {
1478 if ((_flags & F_needs_rebuild) != 0) {
1490 INLINE
void TextNode::
1491 check_measure()
const {
1492 if ((_flags & F_needs_measure) != 0) {
void clear_frame()
Specifies that a border will not be drawn around the text.
void append_wtext(const wstring &text)
Appends the indicates string to the end of the stored wide-character text.
LVecBase4 get_card_as_set() const
Returns the dimensions of the card as set by set_card_as_margin() or set_card_actual().
void clear_font()
Restores the default font to the text.
void set_shadow(PN_stdfloat xoffset, PN_stdfloat yoffset)
Specifies that the text should be drawn with a shadow, by creating a second copy of the text and offs...
wstring get_wordwrapped_wtext() const
Returns a wstring that represents the contents of the text, as it has been formatted by wordwrap rule...
void append_text(const string &text)
Appends the indicates string to the end of the stored text.
void set_wordwrap(PN_stdfloat wordwrap)
Sets the text up to automatically wordwrap when it exceeds the indicated width.
void set_font(TextFont *font)
Sets the font that will be used when making text.
void clear_max_rows()
Resets the TextNode's default behavior of not limiting the number of rows of text.
LPoint3 get_upper_left_3d() const
Returns the upper-left extent of the text object, after it has been transformed into 3-d space by app...
void set_card_actual(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
Similar to set_card_as_margin, except the card is specified in actual coordinate units (relative to t...
void set_indent(PN_stdfloat indent)
Specifies the amount of extra space that is inserted before the first character of each line...
LVecBase4 get_frame_as_set() const
Returns the dimensions of the frame as set by set_frame_as_margin() or set_frame_actual().
PN_stdfloat get_top() const
Returns the topmost extent of the text in local 2-d coordinates, unmodified by the set_transform() ma...
void set_small_caps(bool small_caps)
Sets the small_caps flag.
void set_text(const string &text)
Changes the text that is displayed under the TextNode.
void clear_card()
Specifies that a card will not be drawn behind the text.
void set_glyph_shift(PN_stdfloat glyph_shift)
Specifies a vertical amount to shift each letter of the text as it is placed.
void set_align(Alignment align_type)
Specifies the alignment of the text within its margins.
void clear_align()
Restores the default alignment of the text.
void set_glyph_scale(PN_stdfloat glyph_scale)
Specifies the factor by which to scale each letter of the text as it is placed, in addition to any sc...
void set_frame_line_width(PN_stdfloat line_width)
Specifies the thickness of the lines that will be used to draw the frame.
TextFont * get_font() const
Returns the font currently in use, if any.
void set_bin(const string &bin)
Names the CullBin that the text geometry should be assigned to.
bool has_overflow() const
Returns true if the last text set on the text node exceeded the max_rows constraint, or false if it all fit.
void set_font(TextFont *font)
Sets the font that will be used when making text.
void set_frame_corners(bool corners)
Enables or disables the drawing of corners for the frame.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
wstring decode_text(const string &text) const
Returns the given wstring decoded to a single-byte string, via the current encoding system...
PN_stdfloat get_bottom() const
Returns the bottommost extent of the text in local 2-d coordinates, unmodified by the set_transform()...
void clear_bin()
Removes the effect of a previous call to set_bin().
PN_stdfloat get_left() const
Returns the leftmost extent of the text in local 2-d coordinates, unmodified by the set_transform() m...
void clear_text_color()
Removes the text color specification; the text will be colored whatever it was in the source font fil...
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
void set_frame_as_margin(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
Specifies that a border will be drawn around the text when it is next created.
void clear_text()
Removes the text from the TextEncoder.
void set_small_caps_scale(PN_stdfloat small_caps_scale)
Sets the scale factor applied to lowercase letters from their uppercase equivalents, when the small_caps flag is in effect.
PN_stdfloat get_line_height() const
Returns the number of units high each line of text is.
void set_glyph_scale(PN_stdfloat glyph_scale)
Specifies the factor by which to scale each letter of the text as it is placed.
void set_tab_width(PN_stdfloat tab_width)
Sets the width of each tab stop, in screen units.
bool has_max_rows() const
Returns true if a limit on the height of the TextNode has been set via set_max_rows(), false otherwise.
void set_small_caps(bool small_caps)
Sets the small_caps flag.
PN_stdfloat get_width() const
Returns the net width of the text in local 2-d coordinates.
void clear_text()
Removes the text from the TextNode.
An encapsulation of a font; i.e.
void append_text(const string &text)
Appends the indicates string to the end of the stored text.
bool get_card_decal() const
Returns the card_decal flag.
void clear_text_color()
Removes the text color specification; the text will be colored whatever it was in the source font fil...
void set_wordwrap(PN_stdfloat wordwrap)
Sets the text up to automatically wordwrap when it exceeds the indicated width.
string get_wordwrapped_text() const
Returns a string that represents the contents of the text, as it has been formatted by wordwrap rules...
void set_card_as_margin(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
Specifies that a (possibly opaque or semitransparent) card will be held behind the text when it is ne...
LVecBase4 get_frame_actual() const
Returns the actual dimensions of the frame around the text.
void append_unicode_char(int character)
Appends a single character to the end of the stored text.
This is a 4-by-4 transform matrix.
void set_small_caps_scale(PN_stdfloat small_caps_scale)
Sets the scale factor applied to lowercase letters from their uppercase equivalents, when the small_caps flag is in effect.
void clear_shadow()
Specifies that a shadow will not be drawn behind the text.
string encode_wtext(const wstring &wtext) const
Encodes a wide-text string into a single-char string, according to the current encoding.
void append_unicode_char(wchar_t character)
Appends a single character to the end of the stored text.
void set_wtext(const wstring &wtext)
Changes the text that is displayed under the TextNode, with a wide text.
void clear_bin()
Removes the effect of a previous call to set_bin().
void set_slant(PN_stdfloat slant)
Specifies the factor by which the text slants to the right.
bool is_card_as_margin() const
If this is true, the card was set via a call to set_card_as_margin(), and the dimension of the card a...
This is the base class for all two-component vectors and points.
void update()
Can be called after the TextNode has been fully configured, to force the node to recompute its text i...
void set_card_decal(bool card_decal)
Sets the card_decal flag.
void clear_wordwrap()
Removes the wordwrap setting from the text.
void clear_shadow()
Specifies that a shadow will not be drawn behind the text.
int set_draw_order(int draw_order)
Sets the drawing order of text created by the TextNode.
LVecBase4 get_card_actual() const
Returns the actual dimensions of the card around the text.
void set_indent(PN_stdfloat indent)
Specifies the amount of extra space that is inserted before the first character of each line...
This is the base class for all three-component vectors and points.
int get_max_rows() const
Returns the limit on the height of the TextNode specified by set_max_rows().
void clear_font()
Resets the font to the default font.
LPoint3 get_lower_right_3d() const
Returns the lower-right extent of the text object, after it has been transformed into 3-d space by ap...
int set_draw_order(int draw_order)
Sets the drawing order of text created by the TextMaker.
The primary interface to this module.
void append_wtext(const wstring &text)
Appends the indicates string to the end of the stored wide-character text.
void clear_indent()
Removes the indent setting from the text.
void clear_shadow_color()
Removes the shadow color specification.
void set_bin(const string &bin)
Names the GeomBin that the TextNode geometry should be assigned to.
void set_coordinate_system(CoordinateSystem cs)
Specifies the coordinate system in which the text will be generated.
void set_text(const string &text)
Changes the text that is stored in the encoder.
PN_stdfloat get_line_height() const
Returns the number of units high each line of text is.
LVecBase4 get_card_transformed() const
Returns the actual card dimensions, transformed by the matrix set by set_transform().
PN_stdfloat get_right() const
Returns the rightmost extent of the text in local 2-d coordinates, unmodified by the set_transform() ...
int get_num_rows() const
Returns the number of rows of text that were generated.
void clear_wordwrap()
Removes the wordwrap setting from the TextNode.
void force_update()
Forces the TextNode to recompute itself now, even if it believes nothing has changed.
void set_glyph_shift(PN_stdfloat glyph_shift)
Specifies a vertical amount to shift each letter of the text as it is placed.
void set_frame_actual(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
Similar to set_frame_as_margin, except the frame is specified in actual coordinate units (relative to...
void set_wtext(const wstring &wtext)
Changes the text that is stored in the encoder.
void set_tab_width(PN_stdfloat tab_width)
Sets the width of each tab stop, in screen units.
void set_flatten_flags(int flatten_flags)
Sets the flatten flags.
void set_max_rows(int max_rows)
Sets the maximum number of rows that may be formatted by the TextNode.
void set_usage_hint(Geom::UsageHint usage_hint)
Specifies the UsageHint that will be applied to generated geometry.
PN_stdfloat calc_width(wchar_t character) const
Returns the width of a single character of the font, or 0.0 if the character is not known...
void set_shadow(PN_stdfloat xoffset, PN_stdfloat yoffset)
Specifies that the text should be drawn with a shadow, by creating a second copy of the text and offs...
void set_transform(const LMatrix4 &transform)
Sets an additional transform that is applied to the entire text paragraph.
int get_flatten_flags() const
Returns the flatten flags.
PN_stdfloat get_height() const
Returns the net height of the text in local 2-d coordinates.
bool is_frame_as_margin() const
If this is true, the frame was set via a call to set_frame_as_margin(), and the dimension of the fram...
PN_stdfloat get_frame_line_width() const
Returns the thickness of the lines that will be used to draw the frame.
Geom::UsageHint get_usage_hint() const
Returns the UsageHint that will be applied to generated geometry.