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;
427set_text_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) {
438 _text_color = text_color;
439 _specified |= F_has_text_color;
449 _text_color.set(1.0f, 1.0f, 1.0f, 1.0f);
450 _specified &= ~F_has_text_color;
459 return (_specified & F_has_text_color) != 0;
465INLINE LColor TextProperties::
466get_text_color()
const {
473INLINE
void TextProperties::
474set_shadow_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) {
475 set_shadow_color(LColor(r, g, b, a));
481INLINE
void TextProperties::
482set_shadow_color(
const LColor &shadow_color) {
483 _shadow_color = shadow_color;
484 _specified |= F_has_shadow_color;
485 _shadow_state.clear();
493 _shadow_color.set(0.0f, 0.0f, 0.0f, 1.0f);
494 _specified &= ~F_has_shadow_color;
495 _shadow_state.clear();
501INLINE
bool TextProperties::
502has_shadow_color()
const {
503 return (_specified & F_has_shadow_color) != 0;
509INLINE LColor TextProperties::
510get_shadow_color()
const {
511 return _shadow_color;
519set_shadow(PN_stdfloat xoffset, PN_stdfloat yoffset) {
529 _shadow_offset = shadow_offset;
530 _specified |= F_has_shadow;
538 _specified &= ~F_has_shadow;
539 _shadow_offset.set(0.0f, 0.0f);
545INLINE
bool TextProperties::
547 return (_specified & F_has_shadow) != 0;
556 return _shadow_offset;
569set_bin(
const std::string &bin) {
571 _specified |= F_has_bin;
573 _shadow_state.clear();
582 _bin = std::string();
583 _specified &= ~F_has_bin;
585 _shadow_state.clear();
594 return (_specified & F_has_bin) != 0;
619 _draw_order = draw_order;
620 _specified |= F_has_draw_order;
622 _shadow_state.clear();
623 return _draw_order + 3;
629INLINE
void TextProperties::
632 _specified &= ~F_has_draw_order;
634 _shadow_state.clear();
640INLINE
bool TextProperties::
641has_draw_order()
const {
642 return (_specified & F_has_draw_order) != 0;
659 _tab_width = tab_width;
660 _specified |= F_has_tab_width;
666INLINE
void TextProperties::
668 _tab_width = text_tab_width;
669 _specified &= ~F_has_tab_width;
675INLINE
bool TextProperties::
676has_tab_width()
const {
677 return (_specified & F_has_tab_width) != 0;
701 _glyph_scale = glyph_scale;
702 _specified |= F_has_glyph_scale;
708INLINE
void TextProperties::
710 _specified &= ~F_has_glyph_scale;
717INLINE
bool TextProperties::
718has_glyph_scale()
const {
719 return (_specified & F_has_glyph_scale) != 0;
737 _glyph_shift = glyph_shift;
738 _specified |= F_has_glyph_shift;
744INLINE
void TextProperties::
746 _specified &= ~F_has_glyph_shift;
753INLINE
bool TextProperties::
754has_glyph_shift()
const {
755 return (_specified & F_has_glyph_shift) != 0;
776 _text_scale = text_scale;
777 _specified |= F_has_text_scale;
783INLINE
void TextProperties::
785 _specified &= ~F_has_text_scale;
792INLINE
bool TextProperties::
793has_text_scale()
const {
794 return (_specified & F_has_text_scale) != 0;
813 _direction = direction;
814 _specified |= F_has_direction;
825 _specified &= ~F_has_direction;
834 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.
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.
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.
set_text_color
Sets the color of the text.
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.