30 #if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_TEXT) 31 #error Buildsystem error: BUILDING_PANDA_TEXT not defined 36 Configure(config_text);
37 NotifyCategoryDef(text,
"");
39 ConfigureFn(config_text) {
44 (
"text-flatten",
true,
45 PRC_DESC(
"Set this true to flatten text when it is generated, or false to " 46 "keep it as a deep hierarchy. Usually it's a performance " 47 "advantage to keep this true, but this also depends on the setting " 48 "of text-dynamic-merge. See TextNode::set_flatten_flags()."));
51 (
"text-dynamic-merge",
true,
52 PRC_DESC(
"Set this true to merge generated glyphs into the GeomVertexData " 53 "as the text is assembled, or false to wait for the flatten " 54 "operation. Usually it's a performance " 55 "advantage to keep this true. See TextNode::set_flatten_flags()."));
58 (
"text-kerning",
false,
59 PRC_DESC(
"Set this true to enable kerning when the font provides kerning " 60 "tables. This can result in more aesthetically pleasing spacing " 61 "between individual glyphs. Has no effect when text-use-harfbuzz " 62 "is true, since HarfBuzz offers superior kerning support."));
65 (
"text-use-harfbuzz",
false,
66 PRC_DESC(
"Set this true to enable HarfBuzz support, which offers superior " 67 "text shaping and better support for non-Latin text."));
70 (
"text-anisotropic-degree", 1,
71 PRC_DESC(
"This is the default anisotropic-degree that is set on dynamic " 72 "font textures. Setting this to a value greater than 1 can help " 73 "smooth out the antialiasing for small letters."));
76 (
"text-texture-margin", 2,
77 PRC_DESC(
"This is the number of texels of empty space reserved around each " 78 "glyph in the texture. Setting this value larger will decrease " 79 "the tendency for adjacent glyphs to bleed into each other at " 80 "small sizes, but it will increase amount of wasted texture " 84 (
"text-poly-margin", 0.0f,
85 PRC_DESC(
"This is the amount by which to make each glyph polygon larger " 86 "than strictly necessary, in screen units that are added to each " 87 "margin. Increasing this value will decrease the tendency for " 88 "letters to get chopped off at the edges, but it will also " 89 "increase the tendency for adjacent glyphs to bleed into each " 90 "other (unless you also increase text-texture-margin)."));
93 (
"text-page-size",
"256 256",
94 PRC_DESC(
"This is the default size for new textures created for dynamic " 98 (
"text-small-caps",
false,
99 PRC_DESC(
"This controls the default setting for " 100 "TextNode::set_small_caps()."));
103 (
"text-small-caps-scale", 0.8f,
104 PRC_DESC(
"This controls the default setting for " 105 "TextNode::set_small_caps_scale()."));
108 (
"text-default-font",
"",
109 PRC_DESC(
"This names a filename that will be loaded at startup time as " 110 "the default font for any TextNode that does not specify a font " 111 "otherwise. The default is to use a special font that is " 112 "compiled into Panda, if available."));
115 (
"text-tab-width", 5.0f,
116 PRC_DESC(
"This controls the default setting for " 117 "TextNode::set_tab_width()."));
120 (
"text-push-properties-key", 1,
121 PRC_DESC(
"This is the decimal character number that, embedded in " 122 "a string, is used to bracket the name of a TextProperties " 123 "structure added to the TextPropertiesManager object, to " 124 "control the appearance of subsequent text."));
127 (
"text-pop-properties-key", 2,
128 PRC_DESC(
"This is the decimal character number that undoes the " 129 "effect of a previous appearance of text_push_properties_key."));
132 (
"text-soft-hyphen-key", 3,
133 PRC_DESC(
"This is the decimal character number that, embedded in a " 134 "string, is identified as the soft-hyphen character."));
137 (
"text-soft-break-key", 4,
138 PRC_DESC(
"This is similar to text-soft-hyphen-key, except that " 139 "when it is used as a break point, no character is " 140 "introduced in its place."));
143 (
"text-embed-graphic-key", 5,
144 PRC_DESC(
"This is the decimal character number that, embedded in " 145 "a string, is used to bracket the name of a model " 146 "added to the TextPropertiesManager object, to " 147 "embed an arbitrary graphic image within a paragraph."));
150 get_text_soft_hyphen_output() {
151 static wstring *text_soft_hyphen_output =
nullptr;
153 cv(
"text-soft-hyphen-output",
"-",
154 PRC_DESC(
"This is the string that is output, encoded in the default " 155 "encoding, to represent the hyphen character that is " 156 "introduced when the line is broken at a soft-hyphen key."));
158 if (text_soft_hyphen_output ==
nullptr) {
160 text_soft_hyphen_output =
new wstring(encoder.
decode_text(cv));
163 return *text_soft_hyphen_output;
167 (
"text-hyphen-ratio", 0.7,
168 PRC_DESC(
"If the rightmost whitespace character falls before this " 169 "fraction of the line, hyphenate a word to the right of that " 173 get_text_never_break_before() {
174 static wstring *text_never_break_before =
nullptr;
176 cv(
"text-never-break-before",
",.-:?!;",
177 PRC_DESC(
"This string represents a list of individual characters " 178 "that should never appear at the beginning of a line " 179 "following a forced break. Typically these will be " 180 "punctuation characters."));
182 if (text_never_break_before ==
nullptr) {
184 text_never_break_before =
new wstring(encoder.
decode_text(cv));
187 return *text_never_break_before;
191 (
"text-max-never-break", 3,
192 PRC_DESC(
"If we have more than this number of text-never-break-before " 193 "characters in a row, do not treat any of them as special and " 194 "instead break the line wherever we can."));
197 (
"text-default-underscore-height", -0.2,
198 PRC_DESC(
"Specifies the default height of the underscore line, relative " 199 "to the text baseline, when underscoring is enabled."));
202 (
"text-minfilter", SamplerState::FT_linear,
203 PRC_DESC(
"The default texture minfilter type for dynamic text fonts"));
205 (
"text-magfilter", SamplerState::FT_linear,
206 PRC_DESC(
"The default texture magfilter type for dynamic text fonts"));
208 (
"text-wrap-mode", SamplerState::WM_border_color,
209 PRC_DESC(
"The default wrap mode for dynamic text fonts"));
211 (
"text-quality-level", Texture::QL_best,
212 PRC_DESC(
"The default quality level for dynamic text fonts; see Texture::set_quality_level()."));
215 (
"text-render-mode", TextFont::RM_texture,
216 PRC_DESC(
"The default render mode for dynamic text fonts"));
228 static bool initialized =
false;
234 GeomTextGlyph::init_type();
235 StaticTextFont::init_type();
236 TextFont::init_type();
237 TextGlyph::init_type();
238 TextNode::init_type();
239 TextProperties::init_type();
244 DynamicTextFont::init_type();
245 DynamicTextGlyph::init_type();
246 DynamicTextPage::init_type();
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static PandaSystem * get_global_ptr()
Returns the global PandaSystem object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class is used as a namespace to group several global properties of Panda.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void add_system(const std::string &system)
Intended for use by each subsystem to register itself at startup.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a convenience class to specialize ConfigVariable as an integer type.
static void register_with_read_factory()
Factory method to generate a GeomTextGlyph object.
std::wstring decode_text(const std::string &text) const
Returns the given wstring decoded to a single-byte string, via the current encoding system.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void init_libtext()
Initializes the library.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.