15 #include "config_text.h" 16 #include "staticTextFont.h" 18 #include "textGlyph.h" 20 #include "textProperties.h" 21 #include "dynamicTextFont.h" 22 #include "dynamicTextGlyph.h" 23 #include "dynamicTextPage.h" 24 #include "geomTextGlyph.h" 25 #include "geomTextGlyph.h" 26 #include "unicodeLatinMap.h" 27 #include "pandaSystem.h" 30 #include "config_express.h" 32 Configure(config_text);
33 NotifyCategoryDef(text,
"");
35 ConfigureFn(config_text) {
40 (
"text-flatten",
true,
41 PRC_DESC(
"Set this true to flatten text when it is generated, or false to " 42 "keep it as a deep hierarchy. Usually it's a performance " 43 "advantage to keep this true, but this also depends on the setting " 44 "of text-dynamic-merge. See TextNode::set_flatten_flags()."));
47 (
"text-dynamic-merge",
true,
48 PRC_DESC(
"Set this true to merge generated glyphs into the GeomVertexData " 49 "as the text is assembled, or false to wait for the flatten " 50 "operation. Usually it's a performance " 51 "advantage to keep this true. See TextNode::set_flatten_flags()."));
54 (
"text-anisotropic-degree", 1,
55 PRC_DESC(
"This is the default anisotropic-degree that is set on dynamic " 56 "font textures. Setting this to a value greater than 1 can help " 57 "smooth out the antialiasing for small letters."));
60 (
"text-texture-margin", 2,
61 PRC_DESC(
"This is the number of texels of empty space reserved around each " 62 "glyph in the texture. Setting this value larger will decrease " 63 "the tendency for adjacent glyphs to bleed into each other at " 64 "small sizes, but it will increase amount of wasted texture " 68 (
"text-poly-margin", 0.0f,
69 PRC_DESC(
"This is the amount by which to make each glyph polygon larger " 70 "than strictly necessary, in screen units that are added to each " 71 "margin. Increasing this value will decrease the tendency for " 72 "letters to get chopped off at the edges, but it will also " 73 "increase the tendency for adjacent glyphs to bleed into each " 74 "other (unless you also increase text-texture-margin)."));
77 (
"text-page-size",
"256 256",
78 PRC_DESC(
"This is the default size for new textures created for dynamic " 82 (
"text-small-caps",
false,
83 PRC_DESC(
"This controls the default setting for " 84 "TextNode::set_small_caps()."));
87 (
"text-small-caps-scale", 0.8f,
88 PRC_DESC(
"This controls the default setting for " 89 "TextNode::set_small_caps_scale()."));
92 (
"text-default-font",
"",
93 PRC_DESC(
"This names a filename that will be loaded at startup time as " 94 "the default font for any TextNode that does not specify a font " 95 "otherwise. The default is to use a special font that is " 96 "compiled into Panda, if available."));
99 (
"text-tab-width", 5.0f,
100 PRC_DESC(
"This controls the default setting for " 101 "TextNode::set_tab_width()."));
104 (
"text-push-properties-key", 1,
105 PRC_DESC(
"This is the decimal character number that, embedded in " 106 "a string, is used to bracket the name of a TextProperties " 107 "structure added to the TextPropertiesManager object, to " 108 "control the appearance of subsequent text."));
111 (
"text-pop-properties-key", 2,
112 PRC_DESC(
"This is the decimal character number that undoes the " 113 "effect of a previous appearance of text_push_properties_key."));
116 (
"text-soft-hyphen-key", 3,
117 PRC_DESC(
"This is the decimal character number that, embedded in a " 118 "string, is identified as the soft-hyphen character."));
121 (
"text-soft-break-key", 4,
122 PRC_DESC(
"This is similar to text-soft-hyphen-key, except that " 123 "when it is used as a break point, no character is " 124 "introduced in its place."));
127 (
"text-embed-graphic-key", 5,
128 PRC_DESC(
"This is the decimal character number that, embedded in " 129 "a string, is used to bracket the name of a model " 130 "added to the TextPropertiesManager object, to " 131 "embed an arbitrary graphic image within a paragraph."));
134 get_text_soft_hyphen_output() {
135 static wstring *text_soft_hyphen_output = NULL;
137 cv(
"text-soft-hyphen-output",
"-",
138 PRC_DESC(
"This is the string that is output, encoded in the default " 139 "encoding, to represent the hyphen character that is " 140 "introduced when the line is broken at a soft-hyphen key."));
142 if (text_soft_hyphen_output == NULL) {
144 text_soft_hyphen_output =
new wstring(encoder.
decode_text(cv));
147 return *text_soft_hyphen_output;
151 (
"text-hyphen-ratio", 0.7,
152 PRC_DESC(
"If the rightmost whitespace character falls before this " 153 "fraction of the line, hyphenate a word to the right of that " 157 get_text_never_break_before() {
158 static wstring *text_never_break_before = NULL;
160 cv(
"text-never-break-before",
",.-:?!;",
161 PRC_DESC(
"This string represents a list of individual characters " 162 "that should never appear at the beginning of a line " 163 "following a forced break. Typically these will be " 164 "punctuation characters."));
166 if (text_never_break_before == NULL) {
168 text_never_break_before =
new wstring(encoder.
decode_text(cv));
171 return *text_never_break_before;
175 (
"text-max-never-break", 3,
176 PRC_DESC(
"If we have more than this number of text-never-break-before " 177 "characters in a row, do not treat any of them as special and " 178 "instead break the line wherever we can."));
181 (
"text-default-underscore-height", -0.2,
182 PRC_DESC(
"Specifies the default height of the underscore line, relative " 183 "to the text baseline, when underscoring is enabled."));
186 (
"text-minfilter", SamplerState::FT_linear,
187 PRC_DESC(
"The default texture minfilter type for dynamic text fonts"));
189 (
"text-magfilter", SamplerState::FT_linear,
190 PRC_DESC(
"The default texture magfilter type for dynamic text fonts"));
192 (
"text-wrap-mode", SamplerState::WM_border_color,
193 PRC_DESC(
"The default wrap mode for dynamic text fonts"));
195 (
"text-quality-level", Texture::QL_best,
196 PRC_DESC(
"The default quality level for dynamic text fonts; see Texture::set_quality_level()."));
199 (
"text-render-mode", TextFont::RM_texture,
200 PRC_DESC(
"The default render mode for dynamic text fonts"));
214 static bool initialized =
false;
220 StaticTextFont::init_type();
221 TextFont::init_type();
222 TextGlyph::init_type();
223 TextNode::init_type();
224 TextProperties::init_type();
227 DynamicTextFont::init_type();
228 DynamicTextGlyph::init_type();
229 DynamicTextPage::init_type();
230 GeomTextGlyph::init_type();
231 GeomTextGlyph::init_type();
static PandaSystem * get_global_ptr()
Returns the global PandaSystem object.
This class is used as a namespace to group several global properties of Panda.
This class can be used to convert text between multiple representations, e.g.
This is a convenience class to specialize ConfigVariable as a Filename type.
This is a convenience class to specialize ConfigVariable as a boolean type.
wstring decode_text(const string &text) const
Returns the given wstring decoded to a single-byte string, via the current encoding system...
void add_system(const string &system)
Intended for use by each subsystem to register itself at startup.
This is a convenience class to specialize ConfigVariable as a floating-point type.
This is a convenience class to specialize ConfigVariable as a string type.
This class specializes ConfigVariable as an enumerated type.
This is a convenience class to specialize ConfigVariable as an integer type.
static void register_with_read_factory()
Tells the BamReader how to create objects of type Geom.