16 #include "config_text.h"
17 #include "string_utils.h"
18 #include "geomVertexData.h"
19 #include "geomVertexFormat.h"
20 #include "geomVertexWriter.h"
21 #include "geomLinestrips.h"
36 _space_advance = 0.25f;
47 _is_valid(copy._is_valid),
48 _line_height(copy._line_height),
49 _space_advance(copy._space_advance)
68 write(ostream &out,
int indent_level)
const {
69 indent(out, indent_level)
70 <<
"TextFont " << get_name() <<
"\n";
90 if (_invalid_glyph == (
TextGlyph *)NULL) {
93 return _invalid_glyph;
105 if (cmp_nocase_uh(
string,
"texture") == 0) {
107 }
else if (cmp_nocase_uh(
string,
"wireframe") == 0) {
109 }
else if (cmp_nocase_uh(
string,
"polygon") == 0) {
111 }
else if (cmp_nocase_uh(
string,
"extruded") == 0) {
113 }
else if (cmp_nocase_uh(
string,
"solid") == 0) {
129 if (cmp_nocase_uh(
string,
"default") == 0) {
131 }
else if (cmp_nocase_uh(
string,
"left") == 0) {
133 }
else if (cmp_nocase_uh(
string,
"right") == 0) {
147 make_invalid_glyph() {
148 CPT(GeomVertexFormat) vformat = GeomVertexFormat::get_v3();
153 vertex.add_data3(_line_height * 0.2, 0.0f, _line_height * 0.1f);
154 vertex.add_data3(_line_height * 0.5f, 0.0f, _line_height * 0.1f);
155 vertex.add_data3(_line_height * 0.5f, 0.0f, _line_height * 0.7f);
156 vertex.add_data3(_line_height * 0.2, 0.0f, _line_height * 0.7f);
159 prim->add_consecutive_vertices(0, 4);
161 prim->close_primitive();
164 geom->add_primitive(prim);
167 _line_height * 0.7f);
175 operator << (ostream &out,
TextFont::RenderMode rm) {
177 case TextFont::RM_texture:
178 return out <<
"texture";
179 case TextFont::RM_wireframe:
180 return out <<
"wireframe";
181 case TextFont::RM_polygon:
182 return out <<
"polygon";
183 case TextFont::RM_extruded:
184 return out <<
"extruded";
185 case TextFont::RM_solid:
186 return out <<
"solid";
188 case TextFont::RM_invalid:
189 return out <<
"invalid";
192 return out <<
"(**invalid TextFont::RenderMode(" << (int)rm <<
")**)";
200 operator >> (istream &in, TextFont::RenderMode &rm) {
213 operator << (ostream &out, TextFont::WindingOrder wo) {
215 case TextFont::WO_default:
216 return out <<
"default";
217 case TextFont::WO_left:
218 return out <<
"left";
219 case TextFont::WO_right:
220 return out <<
"right";
222 case TextFont::WO_invalid:
223 return out <<
"invalid";
226 return out <<
"(**invalid TextFont::WindingOrder(" << (int)wo <<
")**)";
234 operator >> (istream &in, TextFont::WindingOrder &wo) {
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
static WindingOrder string_winding_order(const string &string)
Returns the WindingOrder value associated with the given string representation, or WO_invalid if the ...
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
An encapsulation of a font; i.e.
A base class for all things which can have a name.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
A container for geometry primitives.
A representation of a single glyph (character) from a font.
TextGlyph * get_invalid_glyph()
Returns a special glyph that can be used as a placeholder for any character not in the font...
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Defines a series of line strips.
static RenderMode string_render_mode(const string &string)
Returns the RenderMode value associated with the given string representation, or RM_invalid if the st...
TypeHandle is the identifier used to differentiate C++ class types.