22 if (font ==
nullptr) {
38 invalidate_with_measure();
49 invalidate_with_measure();
80 return (_flags & F_has_overflow) != 0;
86 INLINE
void TextNode::
87 set_frame_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) {
88 set_frame_color(LColor(r, g, b, a));
94 INLINE
void TextNode::
95 set_frame_color(
const LColor &frame_color) {
97 if (_frame_color != frame_color) {
98 _frame_color = frame_color;
99 invalidate_no_measure();
106 INLINE LColor TextNode::
107 get_frame_color()
const {
115 INLINE
void TextNode::
116 set_card_border(PN_stdfloat size, PN_stdfloat uv_portion) {
118 if ((_flags & F_has_card_border) == 0 || _card_border_size != size || _card_border_uv_portion != uv_portion) {
119 _flags |= F_has_card_border;
120 _card_border_size = size;
121 _card_border_uv_portion = uv_portion;
122 invalidate_no_measure();
129 INLINE
void TextNode::
130 clear_card_border() {
132 if (_flags & F_has_card_border) {
133 _flags &= ~F_has_card_border;
134 invalidate_no_measure();
141 INLINE PN_stdfloat TextNode::
142 get_card_border_size()
const {
144 return _card_border_size;
150 INLINE PN_stdfloat TextNode::
151 get_card_border_uv_portion()
const {
153 return _card_border_uv_portion;
159 INLINE
bool TextNode::
160 has_card_border()
const {
162 return (_flags & F_has_card_border) != 0;
168 INLINE
void TextNode::
169 set_card_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) {
170 set_card_color(LColor(r, g, b, a));
176 INLINE
void TextNode::
177 set_card_color(
const LColor &card_color) {
179 if (_card_color != card_color) {
180 _card_color = card_color;
181 invalidate_no_measure();
188 INLINE LColor TextNode::
189 get_card_color()
const {
197 INLINE
void TextNode::
198 set_card_texture(
Texture *card_texture) {
199 if (card_texture ==
nullptr) {
200 clear_card_texture();
203 if ((_flags & F_has_card_texture) == 0 || _card_texture != card_texture) {
204 _flags |= F_has_card_texture;
205 _card_texture = card_texture;
206 invalidate_no_measure();
214 INLINE
void TextNode::
215 clear_card_texture() {
217 if (_flags & F_has_card_texture) {
218 _flags &= ~F_has_card_texture;
219 _card_texture =
nullptr;
220 invalidate_no_measure();
227 INLINE
bool TextNode::
228 has_card_texture()
const {
230 return (_flags & F_has_card_texture) != 0;
237 get_card_texture()
const {
239 return _card_texture;
249 set_frame_as_margin(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) {
251 _flags |= (F_has_frame | F_frame_as_margin);
252 _frame_ul.set(left, top);
253 _frame_lr.set(right, bottom);
254 invalidate_no_measure();
264 set_frame_actual(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) {
266 _flags |= F_has_frame;
267 _flags &= ~F_frame_as_margin;
268 _frame_ul.set(left, top);
269 _frame_lr.set(right, bottom);
270 invalidate_no_measure();
279 _flags &= ~F_has_frame;
280 invalidate_no_measure();
286 INLINE
bool TextNode::
289 return (_flags & F_has_frame) != 0;
302 nassertr((_flags & F_has_frame) != 0,
false);
303 return (_flags & F_frame_as_margin) != 0;
315 nassertr((_flags & F_has_frame) != 0, LVecBase4(0.0, 0.0, 0.0, 0.0));
316 return LVecBase4(_frame_ul[0], _frame_lr[0], _frame_lr[1], _frame_ul[1]);
331 if (_flags & F_has_frame) {
332 if (_flags & F_frame_as_margin) {
334 return LVecBase4(_text_ul[0] - _frame_ul[0],
335 _text_lr[0] + _frame_lr[0],
336 _text_lr[1] - _frame_lr[1],
337 _text_ul[1] + _frame_ul[1]);
339 return LVecBase4(_frame_ul[0], _frame_lr[0], _frame_lr[1], _frame_ul[1]);
343 return LVecBase4(_text_ul[0], _text_lr[0], _text_lr[1], _text_ul[1]);
353 _frame_width = frame_width;
354 invalidate_no_measure();
375 _flags |= F_frame_corners;
377 _flags &= ~F_frame_corners;
379 invalidate_no_measure();
385 INLINE
bool TextNode::
386 get_frame_corners()
const {
388 return (_flags & F_frame_corners) != 0;
398 set_card_as_margin(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) {
400 _flags |= (F_has_card | F_card_as_margin);
401 _card_ul.set(left, top);
402 _card_lr.set(right, bottom);
403 invalidate_no_measure();
413 set_card_actual(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) {
415 _flags |= F_has_card;
416 _flags &= ~F_card_as_margin;
417 _card_ul.set(left, top);
418 _card_lr.set(right, bottom);
419 invalidate_no_measure();
431 _flags |= F_card_decal;
433 _flags &= ~F_card_decal;
435 invalidate_no_measure();
444 _flags &= ~F_has_card;
445 invalidate_no_measure();
451 INLINE
bool TextNode::
454 return (_flags & F_has_card) != 0;
463 return (_flags & F_card_decal) != 0;
476 nassertr((_flags & F_has_card) != 0,
false);
477 return (_flags & F_card_as_margin) != 0;
489 nassertr((_flags & F_has_card) != 0, LVecBase4(0.0, 0.0, 0.0, 0.0));
490 return LVecBase4(_card_ul[0], _card_lr[0], _card_lr[1], _card_ul[1]);
505 if (_flags & F_has_card) {
506 if (_flags & F_card_as_margin) {
508 return LVecBase4(_text_ul[0] - _card_ul[0],
509 _text_lr[0] + _card_lr[0],
510 _text_lr[1] - _card_lr[1],
511 _text_ul[1] + _card_ul[1]);
513 return LVecBase4(_card_ul[0], _card_lr[0], _card_lr[1], _card_ul[1]);
517 return LVecBase4(_text_ul[0], _text_lr[0], _text_lr[1], _text_ul[1]);
532 LPoint3 ul = LPoint3(card[0], 0.0, card[3]) * _transform;
533 LPoint3 lr = LPoint3(card[1], 0.0, card[2]) * _transform;
535 return LVecBase4(ul[0], lr[0], lr[2], ul[2]);
544 _transform = transform;
545 invalidate_with_measure();
551 INLINE LMatrix4 TextNode::
552 get_transform()
const {
563 _coordinate_system = coordinate_system;
564 invalidate_with_measure();
570 INLINE CoordinateSystem TextNode::
571 get_coordinate_system()
const {
573 return _coordinate_system;
585 _usage_hint = usage_hint;
586 invalidate_no_measure();
637 _flatten_flags = flatten_flags;
646 return _flatten_flags;
657 invalidate_with_measure();
667 invalidate_with_measure();
688 invalidate_with_measure();
694 INLINE
void TextNode::
697 TextProperties::clear_small_caps();
698 invalidate_with_measure();
710 invalidate_with_measure();
716 INLINE
void TextNode::
717 clear_small_caps_scale() {
719 TextProperties::clear_small_caps_scale();
720 invalidate_with_measure();
726 INLINE
void TextNode::
727 set_slant(PN_stdfloat slant) {
730 invalidate_with_measure();
736 INLINE
void TextNode::
739 TextProperties::clear_slant();
740 invalidate_with_measure();
746 INLINE
void TextNode::
747 set_align(TextNode::Alignment align_type) {
750 invalidate_with_measure();
756 INLINE
void TextNode::
760 invalidate_with_measure();
771 invalidate_with_measure();
777 INLINE
void TextNode::
781 invalidate_with_measure();
792 invalidate_with_measure();
803 invalidate_with_measure();
809 INLINE
void TextNode::
810 set_text_color(
const LColor &text_color) {
812 TextProperties::set_text_color(text_color);
813 invalidate_no_measure();
819 INLINE
void TextNode::
820 set_text_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) {
821 set_text_color(LColor(r, g, b, a));
832 invalidate_no_measure();
838 INLINE
void TextNode::
839 set_shadow_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) {
840 set_shadow_color(LColor(r, g, b, a));
846 INLINE
void TextNode::
847 set_shadow_color(
const LColor &shadow_color) {
849 TextProperties::set_shadow_color(shadow_color);
850 invalidate_no_measure();
856 INLINE
void TextNode::
857 clear_shadow_color() {
860 invalidate_with_measure();
868 set_shadow(PN_stdfloat xoffset, PN_stdfloat yoffset) {
880 invalidate_no_measure();
890 invalidate_no_measure();
903 set_bin(
const std::string &bin) {
906 invalidate_no_measure();
917 invalidate_no_measure();
934 invalidate_no_measure();
941 INLINE
void TextNode::
944 TextProperties::clear_draw_order();
945 invalidate_with_measure();
956 invalidate_with_measure();
962 INLINE
void TextNode::
965 TextProperties::clear_tab_width();
966 invalidate_with_measure();
978 invalidate_with_measure();
984 INLINE
void TextNode::
985 clear_glyph_scale() {
987 TextProperties::clear_glyph_scale();
988 invalidate_with_measure();
1000 invalidate_with_measure();
1006 INLINE
void TextNode::
1007 clear_glyph_shift() {
1009 TextProperties::clear_glyph_shift();
1010 invalidate_with_measure();
1045 return _wordwrapped_wtext;
1099 return _text_ul[1] - _text_lr[1];
1109 return _text_lr[0] - _text_ul[0];
1153 return do_generate();
1176 mark_internal_bounds_stale();
1186 INLINE
void TextNode::
1187 invalidate_no_measure() {
1188 _flags |= F_needs_rebuild;
1197 INLINE
void TextNode::
1198 invalidate_with_measure() {
1199 _flags |= (F_needs_rebuild | F_needs_measure);
1200 mark_internal_bounds_stale();
1207 INLINE
void TextNode::
1208 check_rebuild()
const {
1209 if ((_flags & F_needs_rebuild) != 0) {
1218 INLINE
void TextNode::
1219 check_measure()
const {
1220 if ((_flags & F_needs_measure) != 0) {