17INLINE
bool TextProperties::
19 return !operator == (other);
27 return (_specified != 0);
38 _loaded_default_font =
true;
48 if (!_loaded_default_font) {
61 _specified |= F_has_font;
70 _specified &= ~F_has_font;
76INLINE
bool TextProperties::
78 return (_specified & F_has_font) != 0;
106 _small_caps = small_caps;
107 _specified |= F_has_small_caps;
113INLINE
void TextProperties::
116 _specified &= ~F_has_small_caps;
122INLINE
bool TextProperties::
123has_small_caps()
const {
124 return (_specified & F_has_small_caps) != 0;
142 _small_caps_scale = small_caps_scale;
148INLINE
void TextProperties::
149clear_small_caps_scale() {
150 _small_caps_scale = text_small_caps_scale;
151 _specified &= ~F_has_small_caps_scale;
157INLINE
bool TextProperties::
158has_small_caps_scale()
const {
159 return (_specified & F_has_small_caps_scale) != 0;
169 return _small_caps_scale;
178 _specified |= F_has_slant;
184INLINE
void TextProperties::
187 _specified &= ~F_has_slant;
193INLINE
bool TextProperties::
195 return (_specified & F_has_slant) != 0;
213 _underscore = underscore;
214 _specified |= F_has_underscore;
220INLINE
void TextProperties::
223 _specified &= ~F_has_underscore;
229INLINE
bool TextProperties::
230has_underscore()
const {
231 return (_specified & F_has_underscore) != 0;
249 _underscore_height = underscore_height;
250 _specified |= F_has_underscore_height;
256INLINE
void TextProperties::
257clear_underscore_height() {
258 _underscore_height = 0.0f;
259 _specified &= ~F_has_underscore_height;
265INLINE
bool TextProperties::
266has_underscore_height()
const {
267 return (_specified & F_has_underscore_height) != 0;
275 return has_underscore_height() ? _underscore_height : text_default_underscore_height;
282set_align(TextProperties::Alignment align_type) {
284 _specified |= F_has_align;
293 _specified &= ~F_has_align;
299INLINE
bool TextProperties::
301 return (_specified & F_has_align) != 0;
307INLINE TextProperties::Alignment TextProperties::
319 _specified |= F_has_indent;
327 _indent_width = 0.0f;
328 _specified &= ~F_has_indent;
334INLINE
bool TextProperties::
336 return (_specified & F_has_indent) != 0;
342INLINE PN_stdfloat TextProperties::
344 return _indent_width;
353 _wordwrap_width = wordwrap;
354 _specified |= F_has_wordwrap;
362 _wordwrap_width = 0.0f;
363 _specified &= ~F_has_wordwrap;
369INLINE
bool TextProperties::
370has_wordwrap()
const {
371 return (_specified & F_has_wordwrap) != 0;
377INLINE PN_stdfloat TextProperties::
378get_wordwrap()
const {
379 return _wordwrap_width;
391 _preserve_trailing_whitespace = preserve_trailing_whitespace;
392 _specified |= F_has_preserve_trailing_whitespace;
398INLINE
void TextProperties::
399clear_preserve_trailing_whitespace() {
400 _preserve_trailing_whitespace =
false;
401 _specified &= ~F_has_preserve_trailing_whitespace;
407INLINE
bool TextProperties::
408has_preserve_trailing_whitespace()
const {
409 return (_specified & F_has_preserve_trailing_whitespace) != 0;
418 return _preserve_trailing_whitespace;
424INLINE
void TextProperties::
425set_text_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) {
426 set_text_color(LColor(r, g, b, a));
432INLINE
void TextProperties::
433set_text_color(
const LColor &text_color) {
434 _text_color = text_color;
435 _specified |= F_has_text_color;
445 _text_color.set(1.0f, 1.0f, 1.0f, 1.0f);
446 _specified &= ~F_has_text_color;
453INLINE
bool TextProperties::
454has_text_color()
const {
455 return (_specified & F_has_text_color) != 0;
461INLINE LColor TextProperties::
462get_text_color()
const {
469INLINE
void TextProperties::
470set_shadow_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) {
471 set_shadow_color(LColor(r, g, b, a));
477INLINE
void TextProperties::
478set_shadow_color(
const LColor &shadow_color) {
479 _shadow_color = shadow_color;
480 _specified |= F_has_shadow_color;
481 _shadow_state.clear();
489 _shadow_color.set(0.0f, 0.0f, 0.0f, 1.0f);
490 _specified &= ~F_has_shadow_color;
491 _shadow_state.clear();
497INLINE
bool TextProperties::
498has_shadow_color()
const {
499 return (_specified & F_has_shadow_color) != 0;
505INLINE LColor TextProperties::
506get_shadow_color()
const {
507 return _shadow_color;
515set_shadow(PN_stdfloat xoffset, PN_stdfloat yoffset) {
525 _shadow_offset = shadow_offset;
526 _specified |= F_has_shadow;
534 _specified &= ~F_has_shadow;
535 _shadow_offset.set(0.0f, 0.0f);
541INLINE
bool TextProperties::
543 return (_specified & F_has_shadow) != 0;
552 return _shadow_offset;
565set_bin(
const std::string &bin) {
567 _specified |= F_has_bin;
569 _shadow_state.clear();
578 _bin = std::string();
579 _specified &= ~F_has_bin;
581 _shadow_state.clear();
590 return (_specified & F_has_bin) != 0;
615 _draw_order = draw_order;
616 _specified |= F_has_draw_order;
618 _shadow_state.clear();
619 return _draw_order + 3;
625INLINE
void TextProperties::
628 _specified &= ~F_has_draw_order;
630 _shadow_state.clear();
636INLINE
bool TextProperties::
637has_draw_order()
const {
638 return (_specified & F_has_draw_order) != 0;
655 _tab_width = tab_width;
656 _specified |= F_has_tab_width;
662INLINE
void TextProperties::
664 _tab_width = text_tab_width;
665 _specified &= ~F_has_tab_width;
671INLINE
bool TextProperties::
672has_tab_width()
const {
673 return (_specified & F_has_tab_width) != 0;
697 _glyph_scale = glyph_scale;
698 _specified |= F_has_glyph_scale;
704INLINE
void TextProperties::
706 _specified &= ~F_has_glyph_scale;
713INLINE
bool TextProperties::
714has_glyph_scale()
const {
715 return (_specified & F_has_glyph_scale) != 0;
733 _glyph_shift = glyph_shift;
734 _specified |= F_has_glyph_shift;
740INLINE
void TextProperties::
742 _specified &= ~F_has_glyph_shift;
749INLINE
bool TextProperties::
750has_glyph_shift()
const {
751 return (_specified & F_has_glyph_shift) != 0;
772 _text_scale = text_scale;
773 _specified |= F_has_text_scale;
779INLINE
void TextProperties::
781 _specified &= ~F_has_text_scale;
788INLINE
bool TextProperties::
789has_text_scale()
const {
790 return (_specified & F_has_text_scale) != 0;
809 _direction = direction;
810 _specified |= F_has_direction;
821 _specified &= ~F_has_direction;
830 return (_specified & F_has_direction) != 0;
An encapsulation of a font; i.e.
This defines the set of visual properties that may be assigned to the individual characters of the te...
set_glyph_shift
Specifies a vertical amount to shift each letter of the text as it is placed.
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_small_caps
Returns the small_caps flag.
get_glyph_shift
Returns the vertical shift of each letter as specified by set_glyph_shift().
clear_font
Restores the default font to the text.
clear_shadow
Specifies that a shadow will not be drawn behind the text.
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.
clear_indent
Removes the indent setting from the text.
clear_shadow_color
Removes the shadow color specification.
get_preserve_trailing_whitespace
Returns the preserve_trailing_whitespace flag.
clear_direction
Clears the text direction setting.
get_glyph_scale
Returns the scale factor of each letter as specified by set_glyph_scale().
set_underscore
Sets the underscore flag.
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,...
get_underscore
Returns the underscore flag.
clear_wordwrap
Removes the wordwrap setting from the text.
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().
get_tab_width
Returns the width set via set_tab_width().
has_bin
Returns true if an explicit drawing bin has been set via set_bin(), false otherwise.
clear_align
Restores the default alignment of the text.
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_direction
Specifies the text direction.
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_small_caps
Sets the small_caps flag.
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.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.