20 [](
const entt::meta_any& i)
26 [](
const entt::meta_any& i)
31 entt::meta_factory<text_style>{}
32 .type(
"text_style"_hs)
37 .data<&text_style::set_opacity, &text_style::get_opacity>(
"opacity"_hs)
45 .data<&text_style::set_text_color, &text_style::get_text_color>(
"text_color"_hs)
51 .data<&text_style::set_outline_color, &text_style::get_outline_color>(
"outline_color"_hs)
58 .data<&text_style::outline_width>(
"outline_width"_hs)
67 .data<&text_style::set_shadow_color, &text_style::get_shadow_color>(
"shadow_color"_hs)
74 .data<&text_style::shadow_softener>(
"shadow_softener"_hs)
83 .data<&text_style::shadow_offsets>(
"shadow_offsets"_hs)
90 .data<&text_style::set_style_flags, &text_style::get_style_flags>(
"style_flags"_hs)
97 .data<&text_style::set_background_color, &text_style::get_background_color>(
"background_color"_hs)
104 .data<&text_style::set_foreground_color, &text_style::get_foreground_color>(
"foreground_color"_hs)
111 .data<&text_style::set_overline_color, &text_style::get_overline_color>(
"overline_color"_hs)
118 .data<&text_style::set_underline_color, &text_style::get_underline_color>(
"underline_color"_hs)
125 .data<&text_style::set_strike_color, &text_style::get_strike_color>(
"strike_color"_hs)
134 entt::meta_factory<BT>{}
135 .type(
"buffer_type"_hs)
140 .data<BT::static_buffer>(
"static_buffer"_hs)
145 .data<BT::dynamic_buffer>(
"dynamic_buffer"_hs)
150 .data<BT::transient_buffer>(
"transient_buffer"_hs)
157 entt::meta_factory<OT>{}
158 .type(
"overflow_type"_hs)
163 .data<OT::none>(
"none"_hs)
168 .data<OT::word>(
"word"_hs)
173 .data<OT::grapheme>(
"grapheme"_hs)
180 entt::meta_factory<text_component>{}
181 .type(
"text_component"_hs)
199 entt::attribute{
"example", R
"(<color=blue>Blue text with <background-color=yellow>yellow background</background-color> and <style=underline>underlined</style> <alpha=0.4>transparent words</alpha>.</color>
200<outline-width=1><outline-color=red>This text has a red outline</outline-color> and <shadow-offset=2,2><shadow-color=gray>gray shadow</shadow-color></shadow-offset>.</outline-width>
202<color=green>Green text with <style=overline>overlined</style> and <style=strikethrough>strikethrough</style> styles.</color>
203<shadow-offset=3,3><shadow-color=black><shadow-softener=2>This text has a softened shadow</shadow-softener> and <foreground-color=#FFD70055><color=black>black text with gold transparent foreground</color></foreground-color>.</shadow-color></shadow-offset>
205<color=purple>Purple text with <style=underline|overline>both underline and overline</style> effects.</color>)"},
207 .data<&text_component::set_is_rich_text, &text_component::get_is_rich_text>("is_rich"_hs)
211 entt::attribute{
"tooltip",
"Enable parsing of <color> / <style> tags."},
213 .data<&text_component::set_font, &text_component::get_font>(
"font"_hs)
219 .data<&text_component::set_font_size, &text_component::get_font_size>(
"font_size"_hs)
226 .data<nullptr, &text_component::get_render_font_size>(
"render_font_size"_hs)
232 .data<nullptr, &text_component::get_render_buffers_count>(
"render_buffers_count"_hs)
236 entt::attribute{
"tooltip",
"How many render buffers are used for this text."},
238 .data<&text_component::set_auto_size, &text_component::get_auto_size>(
"auto_size"_hs)
242 entt::attribute{
"tooltip",
"Automatically shrink or grow font to fit area."},
244 .data<&text_component::set_auto_size_range, &text_component::get_auto_size_range>(
"auto_size_range"_hs)
248 entt::attribute{
"tooltip",
"Min/Max font sizes when Auto Size is enabled."},
251 .data<&text_component::set_alignment, &text_component::get_alignment>(
"alignment"_hs)
255 entt::attribute{
"tooltip",
"Horizontal and vertical alignment flags."},
257 .data<&text_component::set_apply_kerning, &text_component::get_apply_kerning>(
"apply_kerning"_hs)
263 .data<&text_component::set_overflow_type, &text_component::get_overflow_type>(
"overflow"_hs)
267 entt::attribute{
"tooltip",
"How text should wrap or overflow the area."},
269 .data<&text_component::set_buffer_type, &text_component::get_buffer_type>(
"buffer_type"_hs)
273 entt::attribute{
"tooltip",
"Static, Dynamic, or Transient text buffer storage."},
275 .data<&text_component::set_area, &text_component::get_area>(
"area"_hs)
281 .data<&text_component::set_style, &text_component::get_style>(
"style"_hs)
307 try_save(ar, ser20::make_nvp(
"text", obj.get_text()));
308 try_save(ar, ser20::make_nvp(
"is_rich", obj.get_is_rich_text()));
309 try_save(ar, ser20::make_nvp(
"font", obj.get_font()));
310 try_save(ar, ser20::make_nvp(
"font_size", obj.get_font_size()));
311 try_save(ar, ser20::make_nvp(
"auto_size", obj.get_auto_size()));
312 try_save(ar, ser20::make_nvp(
"auto_size_range", obj.get_auto_size_range()));
313 try_save(ar, ser20::make_nvp(
"alignment", obj.get_alignment().flags));
314 try_save(ar, ser20::make_nvp(
"overflow", obj.get_overflow_type()));
315 try_save(ar, ser20::make_nvp(
"area", obj.get_area()));
316 try_save(ar, ser20::make_nvp(
"buffer_type", obj.get_buffer_type()));
317 try_save(ar, ser20::make_nvp(
"style", obj.get_style()));
auto get_text() const -> const std::string &
Gets the current text content.
void set_text(const std::string &text)
Sets the text content to be rendered.