14 #ifndef TEXTPROPERTIES_H 15 #define TEXTPROPERTIES_H 65 INLINE
bool is_any_specified()
const;
67 INLINE
static void set_default_font(
TextFont *);
68 INLINE
static TextFont *get_default_font();
70 INLINE
void set_font(
TextFont *font);
71 INLINE
void clear_font();
72 INLINE
bool has_font()
const;
75 INLINE
void set_small_caps(
bool small_caps);
76 INLINE
void clear_small_caps();
77 INLINE
bool has_small_caps()
const;
78 INLINE
bool get_small_caps()
const;
80 INLINE
void set_small_caps_scale(PN_stdfloat small_caps_scale);
81 INLINE
void clear_small_caps_scale();
82 INLINE
bool has_small_caps_scale()
const;
83 INLINE PN_stdfloat get_small_caps_scale()
const;
85 INLINE
void set_slant(PN_stdfloat slant);
86 INLINE
void clear_slant();
87 INLINE
bool has_slant()
const;
88 INLINE PN_stdfloat get_slant()
const;
90 INLINE
void set_underscore(
bool underscore);
91 INLINE
void clear_underscore();
92 INLINE
bool has_underscore()
const;
93 INLINE
bool get_underscore()
const;
95 INLINE
void set_underscore_height(PN_stdfloat underscore_height);
96 INLINE
void clear_underscore_height();
97 INLINE
bool has_underscore_height()
const;
98 INLINE PN_stdfloat get_underscore_height()
const;
100 INLINE
void set_align(Alignment align_type);
101 INLINE
void clear_align();
102 INLINE
bool has_align()
const;
103 INLINE Alignment get_align()
const;
105 INLINE
void set_indent(PN_stdfloat
indent);
106 INLINE
void clear_indent();
107 INLINE
bool has_indent()
const;
108 INLINE PN_stdfloat get_indent()
const;
110 INLINE
void set_wordwrap(PN_stdfloat wordwrap);
111 INLINE
void clear_wordwrap();
112 INLINE
bool has_wordwrap()
const;
113 INLINE PN_stdfloat get_wordwrap()
const;
115 INLINE
void set_preserve_trailing_whitespace(
bool preserve_trailing_whitespace);
116 INLINE
void clear_preserve_trailing_whitespace();
117 INLINE
bool has_preserve_trailing_whitespace()
const;
118 INLINE
bool get_preserve_trailing_whitespace()
const;
120 INLINE
void set_text_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a);
121 INLINE
void set_text_color(
const LColor &text_color);
122 INLINE
void clear_text_color();
123 INLINE
bool has_text_color()
const;
124 INLINE LColor get_text_color()
const;
126 INLINE
void set_shadow_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a);
127 INLINE
void set_shadow_color(
const LColor &shadow_color);
128 INLINE
void clear_shadow_color();
129 INLINE
bool has_shadow_color()
const;
130 INLINE LColor get_shadow_color()
const;
132 INLINE
void set_shadow(PN_stdfloat xoffset, PN_stdfloat yoffset);
133 INLINE
void set_shadow(
const LVecBase2 &shadow_offset);
134 INLINE
void clear_shadow();
135 INLINE
bool has_shadow()
const;
136 INLINE LVector2 get_shadow()
const;
138 INLINE
void set_bin(
const std::string &bin);
139 INLINE
void clear_bin();
140 INLINE
bool has_bin()
const;
141 INLINE
const std::string &get_bin()
const;
143 INLINE
int set_draw_order(
int draw_order);
144 INLINE
void clear_draw_order();
145 INLINE
bool has_draw_order()
const;
146 INLINE
int get_draw_order()
const;
148 INLINE
void set_tab_width(PN_stdfloat tab_width);
149 INLINE
void clear_tab_width();
150 INLINE
bool has_tab_width()
const;
151 INLINE PN_stdfloat get_tab_width()
const;
153 INLINE
void set_glyph_scale(PN_stdfloat glyph_scale);
154 INLINE
void clear_glyph_scale();
155 INLINE
bool has_glyph_scale()
const;
156 INLINE PN_stdfloat get_glyph_scale()
const;
158 INLINE
void set_glyph_shift(PN_stdfloat glyph_shift);
159 INLINE
void clear_glyph_shift();
160 INLINE
bool has_glyph_shift()
const;
161 INLINE PN_stdfloat get_glyph_shift()
const;
163 INLINE
void set_text_scale(PN_stdfloat text_scale);
164 INLINE
void clear_text_scale();
165 INLINE
bool has_text_scale()
const;
166 INLINE PN_stdfloat get_text_scale()
const;
168 INLINE
void set_direction(Direction direction);
169 INLINE
void clear_direction();
170 INLINE
bool has_direction()
const;
171 INLINE Direction get_direction()
const;
175 void write(std::ostream &out,
int indent_level = 0)
const;
178 MAKE_PROPERTY2(font, has_font, get_font, set_font, clear_font);
179 MAKE_PROPERTY2(small_caps, has_small_caps, get_small_caps,
180 set_small_caps, clear_small_caps);
181 MAKE_PROPERTY2(small_caps_scale, has_small_caps_scale, get_small_caps_scale,
182 set_small_caps_scale, clear_small_caps_scale);
183 MAKE_PROPERTY2(slant, has_slant, get_slant, set_slant, clear_slant);
184 MAKE_PROPERTY2(underscore, has_underscore, get_underscore,
185 set_underscore, clear_underscore);
186 MAKE_PROPERTY2(underscore_height, has_underscore_height, get_underscore_height,
187 set_underscore_height, clear_underscore_height);
188 MAKE_PROPERTY2(align, has_align, get_align, set_align, clear_align);
189 MAKE_PROPERTY2(
indent, has_indent, get_indent, set_indent, clear_indent);
190 MAKE_PROPERTY2(wordwrap, has_wordwrap, get_wordwrap, set_wordwrap, clear_wordwrap);
191 MAKE_PROPERTY2(preserve_trailing_whitespace,
192 has_preserve_trailing_whitespace, get_preserve_trailing_whitespace,
193 set_preserve_trailing_whitespace, clear_preserve_trailing_whitespace);
194 MAKE_PROPERTY2(text_color, has_text_color, get_text_color,
195 set_text_color, clear_text_color);
196 MAKE_PROPERTY2(shadow_color, has_shadow_color, get_shadow_color,
197 set_shadow_color, clear_shadow_color);
198 MAKE_PROPERTY2(shadow, has_shadow, get_shadow, set_shadow, clear_shadow);
199 MAKE_PROPERTY2(bin, has_bin, get_bin, set_bin, clear_bin);
200 MAKE_PROPERTY2(draw_order, has_draw_order, get_draw_order,
201 set_draw_order, clear_draw_order);
202 MAKE_PROPERTY2(tab_width, has_tab_width, get_tab_width,
203 set_tab_width, clear_tab_width);
204 MAKE_PROPERTY2(glyph_scale, has_glyph_scale, get_glyph_scale,
205 set_glyph_scale, clear_glyph_scale);
206 MAKE_PROPERTY2(glyph_shift, has_glyph_shift, get_glyph_shift,
207 set_glyph_shift, clear_glyph_shift);
208 MAKE_PROPERTY2(text_scale, has_text_scale, get_text_scale,
209 set_text_scale, clear_text_scale);
210 MAKE_PROPERTY2(direction, has_direction, get_direction,
211 set_direction, clear_direction);
218 static void load_default_font();
221 F_has_font = 0x00000001,
222 F_has_small_caps = 0x00000002,
223 F_has_small_caps_scale = 0x00000004,
224 F_has_slant = 0x00000008,
225 F_has_align = 0x00000010,
226 F_has_indent = 0x00000020,
227 F_has_wordwrap = 0x00000040,
228 F_has_preserve_trailing_whitespace = 0x00000080,
229 F_has_text_color = 0x00000100,
230 F_has_shadow_color = 0x00000200,
231 F_has_shadow = 0x00000400,
232 F_has_bin = 0x00000800,
233 F_has_draw_order = 0x00001000,
234 F_has_tab_width = 0x00002000,
235 F_has_glyph_scale = 0x00004000,
236 F_has_glyph_shift = 0x00008000,
237 F_has_underscore = 0x00010000,
238 F_has_underscore_height = 0x00020000,
239 F_has_text_scale = 0x00040000,
240 F_has_direction = 0x00080000,
247 PN_stdfloat _small_caps_scale;
250 PN_stdfloat _underscore_height;
252 PN_stdfloat _indent_width;
253 PN_stdfloat _wordwrap_width;
254 bool _preserve_trailing_whitespace;
256 LColor _shadow_color;
257 LVector2 _shadow_offset;
260 PN_stdfloat _tab_width;
261 PN_stdfloat _glyph_scale;
262 PN_stdfloat _glyph_shift;
263 PN_stdfloat _text_scale;
264 Direction _direction;
270 static bool _loaded_default_font;
276 static void init_type() {
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An encapsulation of a font; i.e.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This defines the set of visual properties that may be assigned to the individual characters of the te...
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.