52 INLINE
void set_usage_hint(Geom::UsageHint usage_hint);
53 INLINE Geom::UsageHint get_usage_hint()
const;
55 INLINE
void set_max_rows(
int max_rows);
56 INLINE
int get_max_rows()
const;
58 INLINE
void set_dynamic_merge(
bool dynamic_merge);
59 INLINE
bool get_dynamic_merge()
const;
61 INLINE
void set_multiline_mode(
bool flag);
62 INLINE
bool get_multiline_mode()
const;
67 bool set_wtext(
const std::wstring &wtext);
68 bool set_wsubstr(
const std::wstring &wtext,
int start,
int count);
70 std::wstring get_plain_wtext()
const;
71 std::wstring get_wordwrapped_plain_wtext()
const;
72 std::wstring get_wtext()
const;
73 std::wstring get_wordwrapped_wtext()
const;
75 bool calc_r_c(
int &r,
int &c,
int n)
const;
76 INLINE
int calc_r(
int n)
const;
77 INLINE
int calc_c(
int n)
const;
78 int calc_index(
int r,
int c)
const;
80 INLINE
int get_num_characters()
const;
81 INLINE
char32_t get_character(
int n)
const;
84 INLINE PN_stdfloat get_width(
int n)
const;
86 INLINE
int get_num_rows()
const;
87 INLINE
int get_num_cols(
int r)
const;
88 INLINE
char32_t get_character(
int r,
int c)
const;
89 INLINE
const TextGraphic *get_graphic(
int r,
int c)
const;
91 INLINE PN_stdfloat get_width(
int r,
int c)
const;
92 PN_stdfloat get_xpos(
int r,
int c)
const;
93 INLINE PN_stdfloat get_ypos(
int r,
int c)
const;
97 INLINE
const LVector2 &get_ul()
const;
98 INLINE
const LVector2 &get_lr()
const;
100 static PN_stdfloat calc_width(
wchar_t character,
const TextProperties &properties);
101 static PN_stdfloat calc_width(
char32_t character,
const TextProperties &properties);
104 static bool has_exact_character(
wchar_t character,
const TextProperties &properties);
105 static bool has_character(
wchar_t character,
const TextProperties &properties);
106 static bool is_whitespace(
wchar_t character,
const TextProperties &properties);
109 MAKE_PROPERTY(usage_hint, get_usage_hint, set_usage_hint);
110 MAKE_PROPERTY(max_rows, get_max_rows, set_max_rows);
111 MAKE_PROPERTY(dynamic_merge, get_dynamic_merge, set_dynamic_merge);
112 MAKE_PROPERTY(multiline_mode, get_multiline_mode, set_multiline_mode);
113 MAKE_PROPERTY(properties, get_properties, set_properties);
119 INLINE ComputedProperties(ComputedProperties *based_on,
121 void append_delta(std::wstring &wtext, ComputedProperties *other);
123 PT(ComputedProperties) _based_on;
133 class TextCharacter {
135 INLINE TextCharacter(
wchar_t character, ComputedProperties *cprops);
136 INLINE TextCharacter(
char32_t character, ComputedProperties *cprops);
138 const std::wstring &graphic_wname,
139 ComputedProperties *cprops);
140 INLINE TextCharacter(
const TextCharacter ©);
141 INLINE
void operator = (
const TextCharacter ©);
145 std::wstring _graphic_wname;
146 PT(ComputedProperties) _cprops;
152 INLINE TextRow(
int row_start);
153 INLINE TextRow(
const TextRow ©);
154 INLINE
void operator = (
const TextRow ©);
158 bool _got_soft_hyphens;
161 PT(ComputedProperties) _eol_cprops;
165 PT(ComputedProperties) _initial_cprops;
168 TextString _text_string;
171 TextBlock _text_block;
173 void scan_wtext(TextString &output_string,
174 std::wstring::const_iterator &si,
175 const std::wstring::const_iterator &send,
176 ComputedProperties *current_cprops);
178 bool wordwrap_text();
180 INLINE
static PN_stdfloat calc_width(
const TextCharacter &tch);
181 static PN_stdfloat calc_hyphen_width(
const TextCharacter &tch);
186 class GeomCollectorKey {
189 INLINE
bool operator < (
const GeomCollectorKey &other)
const;
197 class GeomCollector {
200 GeomCollector(
const GeomCollector ©);
202 INLINE
void count_geom(
const Geom *geom);
205 const LMatrix4 &xform);
218 LVecBase4 _dimensions;
220 PN_stdfloat _slantl, _slanth;
223 typedef epvector<QuadDef> QuadDefs;
226 void generate_quads(
GeomNode *geom_node,
const QuadMap &quad_map);
228 class GlyphPlacement {
231 const LVector2 &offset = LVector2::zero())
const;
233 void assign_append_to(GeomCollectorMap &geom_collector_map,
const RenderState *state,
234 const LVector2 &offset = LVector2::zero())
const;
235 void assign_quad_to(QuadMap &quad_map,
const RenderState *state,
236 const LVector2 &offset = LVector2::zero())
const;
241 PN_stdfloat _xpos, _ypos;
242 PN_stdfloat _scale, _slant;
247 void assemble_paragraph(PlacedGlyphs &placed_glyphs);
248 void assemble_row(TextRow &row,
249 PlacedGlyphs &row_placed_glyphs,
250 PN_stdfloat &row_width, PN_stdfloat &line_height,
251 TextProperties::Alignment &align, PN_stdfloat &wordwrap);
253 void shape_buffer(hb_buffer_t *buf, PlacedGlyphs &glyphs, PN_stdfloat &xpos,
258 enum CheesyPosition {
265 enum CheesyTransform {
274 CT_squash_mirror_diag,
276 CT_small_squash_mirror_y,
277 CT_small_squash_mirror_diag,
287 PN_stdfloat underscore_start, PN_stdfloat underscore_end,
291 get_character_glyphs(
int character,
const TextProperties *properties,
294 UnicodeLatinMap::AccentType &accent_type,
295 int &additional_flags,
296 PN_stdfloat &glyph_scale, PN_stdfloat &advance_scale);
299 tack_on_accent(UnicodeLatinMap::AccentType accent_type,
300 const LPoint3 &min_vert,
const LPoint3 &max_vert,
301 const LPoint3 ¢roid,
302 const TextProperties *properties, GlyphPlacement &placement)
const;
304 tack_on_accent(
wchar_t accent_mark, CheesyPosition position,
305 CheesyTransform transform,
306 const LPoint3 &min_vert,
const LPoint3 &max_vert,
307 const LPoint3 ¢roid,
308 const TextProperties *properties, GlyphPlacement &placement)
const;
313 PN_stdfloat _next_row_ypos;
316 Geom::UsageHint _usage_hint;
319 bool _multiline_mode;
This is a specialization on Geom for containing a primitive intended to represent a TextGlyph.
This class is not normally used directly by user code, but is used by the TextNode to lay out a block...
This class can be used to convert text between multiple representations, e.g.
A representation of a single glyph (character) from a font.
This defines a special model that has been constructed for the purposes of embedding an arbitrary gra...
This defines the set of visual properties that may be assigned to the individual characters of the te...
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.