37 _space_advance = 0.25f;
38 _total_poly_margin = 0.0f;
47 _is_valid(copy._is_valid),
48 _line_height(copy._line_height),
49 _space_advance(copy._space_advance),
50 _total_poly_margin(copy._total_poly_margin)
75 write(ostream &out,
int indent_level)
const {
77 <<
"TextFont " << get_name() <<
"\n";
93 if (_invalid_glyph ==
nullptr) {
96 return _invalid_glyph;
106 if (cmp_nocase_uh(
string,
"texture") == 0) {
108 }
else if (cmp_nocase_uh(
string,
"wireframe") == 0) {
110 }
else if (cmp_nocase_uh(
string,
"polygon") == 0) {
112 }
else if (cmp_nocase_uh(
string,
"extruded") == 0) {
114 }
else if (cmp_nocase_uh(
string,
"solid") == 0) {
116 }
else if (cmp_nocase_uh(
string,
"distance_field") == 0) {
117 return RM_distance_field;
127 make_invalid_glyph() {
130 new GeomVertexData(
"invalid_glyph", vformat, GeomEnums::UH_static);
133 vertex.add_data3(_line_height * 0.2, 0.0f, _line_height * 0.1f);
134 vertex.add_data3(_line_height * 0.5f, 0.0f, _line_height * 0.1f);
135 vertex.add_data3(_line_height * 0.5f, 0.0f, _line_height * 0.7f);
136 vertex.add_data3(_line_height * 0.2, 0.0f, _line_height * 0.7f);
139 prim->add_consecutive_vertices(0, 4);
141 prim->close_primitive();
144 geom->add_primitive(prim);
146 _invalid_glyph =
new TextGlyph(0, geom, RenderState::make_empty(),
147 _line_height * 0.7f);
154 operator << (ostream &out, TextFont::RenderMode rm) {
156 case TextFont::RM_texture:
157 return out <<
"texture";
158 case TextFont::RM_wireframe:
159 return out <<
"wireframe";
160 case TextFont::RM_polygon:
161 return out <<
"polygon";
162 case TextFont::RM_extruded:
163 return out <<
"extruded";
164 case TextFont::RM_solid:
165 return out <<
"solid";
166 case TextFont::RM_distance_field:
167 return out <<
"distance-field";
169 case TextFont::RM_invalid:
170 return out <<
"invalid";
173 return out <<
"(**invalid TextFont::RenderMode(" << (int)rm <<
")**)";
180 operator >> (istream &in, TextFont::RenderMode &rm) {
virtual PN_stdfloat get_kerning(int first, int second) const
Returns the amount by which to offset the second glyph when it directly follows the first glyph.
This object provides a high-level interface for quickly writing a sequence of numeric values from a v...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static RenderMode string_render_mode(const std::string &string)
Returns the RenderMode value associated with the given string representation, or RM_invalid if the st...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An encapsulation of a font; i.e.
A base class for all things which can have a name.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Defines a series of line strips.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.