21 INLINE
bool TextProperties::
23 return !operator == (other);
34 return (_specified != 0);
48 _loaded_default_font =
true;
61 if (!_loaded_default_font) {
77 _specified |= F_has_font;
88 _specified &= ~F_has_font;
96 INLINE
bool TextProperties::
98 return (_specified & F_has_font) != 0;
135 _small_caps = small_caps;
136 _specified |= F_has_small_caps;
144 INLINE
void TextProperties::
147 _specified &= ~F_has_small_caps;
155 INLINE
bool TextProperties::
156 has_small_caps()
const {
157 return (_specified & F_has_small_caps) != 0;
180 _small_caps_scale = small_caps_scale;
188 INLINE
void TextProperties::
189 clear_small_caps_scale() {
190 _small_caps_scale = text_small_caps_scale;
191 _specified &= ~F_has_small_caps_scale;
199 INLINE
bool TextProperties::
200 has_small_caps_scale()
const {
201 return (_specified & F_has_small_caps_scale) != 0;
214 return _small_caps_scale;
226 _specified |= F_has_slant;
234 INLINE
void TextProperties::
237 _specified &= ~F_has_slant;
245 INLINE
bool TextProperties::
247 return (_specified & F_has_slant) != 0;
271 _underscore = underscore;
272 _specified |= F_has_underscore;
280 INLINE
void TextProperties::
283 _specified &= ~F_has_underscore;
291 INLINE
bool TextProperties::
292 has_underscore()
const {
293 return (_specified & F_has_underscore) != 0;
316 _underscore_height = underscore_height;
317 _specified |= F_has_underscore_height;
325 INLINE
void TextProperties::
326 clear_underscore_height() {
327 _underscore_height = 0.0f;
328 _specified &= ~F_has_underscore_height;
336 INLINE
bool TextProperties::
337 has_underscore_height()
const {
338 return (_specified & F_has_underscore_height) != 0;
349 return has_underscore_height() ? _underscore_height : text_default_underscore_height;
361 _specified |= F_has_align;
372 _specified &= ~F_has_align;
380 INLINE
bool TextProperties::
382 return (_specified & F_has_align) != 0;
390 INLINE TextProperties::Alignment TextProperties::
404 _indent_width = indent;
405 _specified |= F_has_indent;
416 _indent_width = 0.0f;
417 _specified &= ~F_has_indent;
425 INLINE
bool TextProperties::
427 return (_specified & F_has_indent) != 0;
435 INLINE PN_stdfloat TextProperties::
437 return _indent_width;
449 _wordwrap_width = wordwrap;
450 _specified |= F_has_wordwrap;
461 _wordwrap_width = 0.0f;
462 _specified &= ~F_has_wordwrap;
470 INLINE
bool TextProperties::
471 has_wordwrap()
const {
472 return (_specified & F_has_wordwrap) != 0;
480 INLINE PN_stdfloat TextProperties::
481 get_wordwrap()
const {
482 return _wordwrap_width;
498 _preserve_trailing_whitespace = preserve_trailing_whitespace;
499 _specified |= F_has_preserve_trailing_whitespace;
507 INLINE
void TextProperties::
508 clear_preserve_trailing_whitespace() {
509 _preserve_trailing_whitespace =
false;
510 _specified &= ~F_has_preserve_trailing_whitespace;
518 INLINE
bool TextProperties::
519 has_preserve_trailing_whitespace()
const {
520 return (_specified & F_has_preserve_trailing_whitespace) != 0;
531 return _preserve_trailing_whitespace;
539 INLINE
void TextProperties::
540 set_text_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) {
541 set_text_color(
LColor(r, g, b, a));
549 INLINE
void TextProperties::
550 set_text_color(
const LColor &text_color) {
551 _text_color = text_color;
552 _specified |= F_has_text_color;
563 _text_color.set(1.0f, 1.0f, 1.0f, 1.0f);
564 _specified &= ~F_has_text_color;
572 INLINE
bool TextProperties::
573 has_text_color()
const {
574 return (_specified & F_has_text_color) != 0;
582 INLINE
LColor TextProperties::
583 get_text_color()
const {
592 INLINE
void TextProperties::
593 set_shadow_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) {
594 set_shadow_color(
LColor(r, g, b, a));
602 INLINE
void TextProperties::
603 set_shadow_color(
const LColor &shadow_color) {
604 _shadow_color = shadow_color;
605 _specified |= F_has_shadow_color;
615 _shadow_color.set(0.0f, 0.0f, 0.0f, 1.0f);
616 _specified &= ~F_has_shadow_color;
624 INLINE
bool TextProperties::
625 has_shadow_color()
const {
626 return (_specified & F_has_shadow_color) != 0;
634 INLINE
LColor TextProperties::
635 get_shadow_color()
const {
636 return _shadow_color;
660 _shadow_offset = shadow_offset;
661 _specified |= F_has_shadow;
672 _specified &= ~F_has_shadow;
673 _shadow_offset.set(0.0f, 0.0f);
681 INLINE
bool TextProperties::
683 return (_specified & F_has_shadow) != 0;
695 return _shadow_offset;
713 _specified |= F_has_bin;
727 _specified &= ~F_has_bin;
738 return (_specified & F_has_bin) != 0;
769 _draw_order = draw_order;
770 _specified |= F_has_draw_order;
771 return _draw_order + 3;
779 INLINE
void TextProperties::
782 _specified &= ~F_has_draw_order;
790 INLINE
bool TextProperties::
791 has_draw_order()
const {
792 return (_specified & F_has_draw_order) != 0;
814 _tab_width = tab_width;
815 _specified |= F_has_tab_width;
823 INLINE
void TextProperties::
825 _tab_width = text_tab_width;
826 _specified &= ~F_has_tab_width;
834 INLINE
bool TextProperties::
835 has_tab_width()
const {
836 return (_specified & F_has_tab_width) != 0;
868 _glyph_scale = glyph_scale;
869 _specified |= F_has_glyph_scale;
877 INLINE
void TextProperties::
878 clear_glyph_scale() {
879 _specified &= ~F_has_glyph_scale;
888 INLINE
bool TextProperties::
889 has_glyph_scale()
const {
890 return (_specified & F_has_glyph_scale) != 0;
914 _glyph_shift = glyph_shift;
915 _specified |= F_has_glyph_shift;
923 INLINE
void TextProperties::
924 clear_glyph_shift() {
925 _specified &= ~F_has_glyph_shift;
934 INLINE
bool TextProperties::
935 has_glyph_shift()
const {
936 return (_specified & F_has_glyph_shift) != 0;
963 _text_scale = text_scale;
964 _specified |= F_has_text_scale;
972 INLINE
void TextProperties::
974 _specified &= ~F_has_text_scale;
983 INLINE
bool TextProperties::
984 has_text_scale()
const {
985 return (_specified & F_has_text_scale) != 0;
bool is_any_specified() const
Returns true if any properties have been specified, false otherwise.
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...
PN_stdfloat get_underscore_height() const
Returns the vertical height of the underscore; see set_underscore_height().
void set_font(TextFont *font)
Sets the font that will be used when making text.
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_underscore_height(PN_stdfloat underscore_height)
Specifies the vertical height of the underscore, relative to the text baseline.
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...
TextFont * get_font() const
Returns the font currently in use, if any.
PN_stdfloat get_slant() const
Returns the factor by which the text is specified to slant to the right.
void set_bin(const string &bin)
Names the CullBin that the text geometry should be assigned to.
static TextFont * get_default_font()
Specifies the default font to be used for any TextNode whose font is uninitialized or NULL...
PN_stdfloat get_tab_width() const
Returns the width set via set_tab_width().
bool get_small_caps() const
Returns the small_caps flag.
bool get_underscore() const
Returns the underscore flag.
void set_text_scale(PN_stdfloat text_scale)
Specifies the factor by which to scale the text, in addition to any scalings imposed by the node...
void clear_text_color()
Removes the text color specification; the text will be colored whatever it was in the source font fil...
void set_small_caps(bool small_caps)
Sets the small_caps flag.
An encapsulation of a font; i.e.
PN_stdfloat get_glyph_scale() const
Returns the scale factor of each letter as specified by set_glyph_scale().
void set_wordwrap(PN_stdfloat wordwrap)
Sets the text up to automatically wordwrap when it exceeds the indicated width.
static void set_default_font(TextFont *)
Specifies the default font to be used for any TextNode whose font is uninitialized or NULL...
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.
bool get_preserve_trailing_whitespace() const
Returns the preserve_trailing_whitespace flag.
int get_draw_order() const
Returns the drawing order set with set_draw_order().
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.
This is the base class for all two-component vectors and points.
void clear_wordwrap()
Removes the wordwrap setting from the text.
int set_draw_order(int draw_order)
Sets the drawing order of text created by the TextNode.
void set_indent(PN_stdfloat indent)
Specifies the amount of extra space that is inserted before the first character of each line...
void set_underscore(bool underscore)
Sets the underscore flag.
This is the base class for all three-component vectors and points.
This is a two-component vector offset.
This defines the set of visual properties that may be assigned to the individual characters of the te...
void clear_indent()
Removes the indent setting from the text.
void clear_shadow_color()
Removes the shadow color specification.
const string & get_bin() const
Returns the drawing bin set with set_bin(), or empty string if no bin has been set.
PN_stdfloat get_glyph_shift() const
Returns the vertical shift of each letter as specified by set_glyph_shift().
PN_stdfloat get_small_caps_scale() const
Returns the scale factor applied to lowercase letters from their uppercase equivalents, when the small_caps flag is in effect.
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_tab_width(PN_stdfloat tab_width)
Sets the width of each tab stop, in screen units.
void set_preserve_trailing_whitespace(bool preserve_trailing_whitespace)
Sets the preserve_trailing_whitespace flag.
bool has_bin() const
Returns true if an explicit drawing bin has been set via set_bin(), false otherwise.
PN_stdfloat get_text_scale() const
Returns the scale factor of the text as specified by set_text_scale().
LVector2 get_shadow() const
Returns the offset of the shadow as set by set_shadow().