|
Unravel Engine C++ Reference
|
#include <text_component.h>
Public Types | |
| enum class | buffer_type : uint32_t { static_buffer , dynamic_buffer , transient_buffer } |
| enum class | overflow_type : uint32_t { none , word , grapheme } |
Public Types inherited from unravel::component_crtp< text_component > | |
| using | base |
Public Member Functions | |
| void | set_text (const std::string &text) |
| Sets the text content to be rendered. | |
| auto | get_text () const -> const std::string & |
| Gets the current text content. | |
| void | set_style (const text_style &style) |
| Sets the text styling properties. | |
| auto | get_style () const -> const text_style & |
| Gets the current text style settings. | |
| void | set_buffer_type (const buffer_type &type) |
| Sets the buffer type for text rendering. | |
| auto | get_buffer_type () const -> const buffer_type & |
| Gets the current buffer type. | |
| void | set_overflow_type (const overflow_type &type) |
| Sets how text should overflow when it exceeds its bounds. | |
| auto | get_overflow_type () const -> const overflow_type & |
| Gets the current overflow handling type. | |
| void | set_font (const asset_handle< font > &font) |
| Sets the font to be used for rendering text. | |
| auto | get_font () const -> const asset_handle< font > & |
| Gets the current font. | |
| void | set_font_size (uint32_t font_size) |
| Sets the font size in pixels. | |
| auto | get_font_size () const -> uint32_t |
| Gets the current font size. | |
| void | set_auto_size (bool auto_size) |
| Enables or disables automatic font sizing. | |
| auto | get_auto_size () const -> bool |
| Checks if auto-sizing is enabled. | |
| auto | get_render_font_size () const -> uint32_t |
| Gets the actual font size being used for rendering. | |
| void | set_area (const fsize_t &area) |
| Sets the area bounds for text rendering. | |
| auto | get_area () const -> const fsize_t & |
| Gets the current text area bounds. | |
| void | set_auto_size_range (const urange32_t &range) |
| Sets the range for automatic font sizing. | |
| auto | get_auto_size_range () const -> const urange32_t & |
| Gets the current auto-size range. | |
| void | set_is_rich_text (bool is_rich) |
| Enables or disables rich text processing. | |
| auto | get_is_rich_text () const -> bool |
| Checks if rich text processing is enabled. | |
| void | set_apply_kerning (bool apply_kerning) |
| Enables or disables kerning in text rendering. | |
| auto | get_apply_kerning () const -> bool |
| Checks if kerning is enabled. | |
| void | set_alignment (const alignment &align) |
| Sets the text alignment properties. | |
| auto | get_alignment () const -> const alignment & |
| Gets the current text alignment settings. | |
| auto | get_scaled_font () const -> const scaled_font & |
| Gets the scaled font instance used for rendering. | |
| auto | get_render_area () const -> fsize_t |
| Gets the actual area used for rendering. | |
| auto | can_be_rendered () const -> bool |
| Checks if the text can be rendered. | |
| auto | get_bounds () const -> math::bbox |
| Gets the bounding box of the text. | |
| auto | get_render_bounds () const -> math::bbox |
| Gets the bounding box used for rendering. | |
| auto | get_render_buffers_count () const -> size_t |
| Gets the number of render buffers being used. | |
| auto | get_lines (bool include_breaks=true) const -> text_vector< text_line > |
| Gets the text content split into lines. | |
| auto | meters_to_px (float meters) const -> float |
| Converts meters to pixels based on current font metrics. | |
| auto | px_to_meters (float px) const -> float |
| Converts pixels to meters based on current font metrics. | |
| void | submit (gfx::view_id id, const math::transform &world, uint64_t state) |
| Submits the text for rendering. | |
Public Member Functions inherited from unravel::basic_component | |
| void | touch () |
| Marks the component as 'touched'. | |
Additional Inherited Members | |
Public Attributes inherited from unravel::basic_component | |
| bool | eto {} |
| Disable empty type optimizations. | |
Static Public Attributes inherited from unravel::component_crtp< text_component > | |
| static constexpr bool | in_place_delete |
| Indicates if the component can be deleted in place. | |
Definition at line 185 of file text_component.h.
|
strong |
| Enumerator | |
|---|---|
| static_buffer | |
| dynamic_buffer | |
| transient_buffer | |
Definition at line 188 of file text_component.h.
|
strong |
| Enumerator | |
|---|---|
| none | |
| word | |
| grapheme | |
Definition at line 195 of file text_component.h.
| auto unravel::text_component::can_be_rendered | ( | ) | const -> bool |
Checks if the text can be rendered.
Definition at line 1316 of file text_component.cpp.
| auto unravel::text_component::get_alignment | ( | ) | const -> const alignment& |
Gets the current text alignment settings.
Definition at line 1210 of file text_component.cpp.
| auto unravel::text_component::get_apply_kerning | ( | ) | const -> bool |
Checks if kerning is enabled.
Definition at line 1194 of file text_component.cpp.
| auto unravel::text_component::get_area | ( | ) | const -> const fsize_t& |
Gets the current text area bounds.
Definition at line 1226 of file text_component.cpp.
| auto unravel::text_component::get_auto_size | ( | ) | const -> bool |
Checks if auto-sizing is enabled.
Definition at line 1157 of file text_component.cpp.
| auto unravel::text_component::get_auto_size_range | ( | ) | const -> const urange32_t& |
Gets the current auto-size range.
Definition at line 1242 of file text_component.cpp.
| auto unravel::text_component::get_bounds | ( | ) | const -> math::bbox |
Gets the bounding box of the text.
Definition at line 1247 of file text_component.cpp.
| auto unravel::text_component::get_buffer_type | ( | ) | const -> const buffer_type& |
Gets the current buffer type.
Definition at line 962 of file text_component.cpp.
| auto unravel::text_component::get_font | ( | ) | const -> const asset_handle<font>& |
Gets the current font.
Definition at line 992 of file text_component.cpp.
| auto unravel::text_component::get_font_size | ( | ) | const -> uint32_t |
Gets the current font size.
Definition at line 1141 of file text_component.cpp.
| auto unravel::text_component::get_is_rich_text | ( | ) | const -> bool |
Checks if rich text processing is enabled.
Definition at line 1178 of file text_component.cpp.
| auto unravel::text_component::get_lines | ( | bool | include_breaks = true | ) | const -> text_vector<text_line> |
Gets the text content split into lines.
| include_breaks | Whether to include line break symbols in the output |
Definition at line 1282 of file text_component.cpp.
| auto unravel::text_component::get_overflow_type | ( | ) | const -> const overflow_type& |
Gets the current overflow handling type.
Definition at line 976 of file text_component.cpp.
| auto unravel::text_component::get_render_area | ( | ) | const -> fsize_t |
Gets the actual area used for rendering.
Definition at line 1324 of file text_component.cpp.
| auto unravel::text_component::get_render_bounds | ( | ) | const -> math::bbox |
Gets the bounding box used for rendering.
Definition at line 1262 of file text_component.cpp.
| auto unravel::text_component::get_render_buffers_count | ( | ) | const -> size_t |
Gets the number of render buffers being used.
Definition at line 1277 of file text_component.cpp.
| auto unravel::text_component::get_render_font_size | ( | ) | const -> uint32_t |
Gets the actual font size being used for rendering.
Definition at line 1162 of file text_component.cpp.
| auto unravel::text_component::get_scaled_font | ( | ) | const -> const scaled_font& |
Gets the scaled font instance used for rendering.
Definition at line 997 of file text_component.cpp.
| auto unravel::text_component::get_style | ( | ) | const -> const text_style& |
Gets the current text style settings.
Definition at line 948 of file text_component.cpp.
| auto unravel::text_component::get_text | ( | ) | const -> const std::string& |
Gets the current text content.
Definition at line 933 of file text_component.cpp.
| auto unravel::text_component::meters_to_px | ( | float | meters | ) | const -> float |
Converts meters to pixels based on current font metrics.
| meters | The value in meters to convert |
Definition at line 1307 of file text_component.cpp.
| auto unravel::text_component::px_to_meters | ( | float | px | ) | const -> float |
Converts pixels to meters based on current font metrics.
| px | The value in pixels to convert |
Definition at line 1311 of file text_component.cpp.
| void unravel::text_component::set_alignment | ( | const alignment & | align | ) |
Sets the text alignment properties.
| align | The alignment flags for horizontal and vertical positioning |
Definition at line 1199 of file text_component.cpp.
| void unravel::text_component::set_apply_kerning | ( | bool | apply_kerning | ) |
Enables or disables kerning in text rendering.
| apply_kerning | True to enable kerning, false to disable |
Definition at line 1183 of file text_component.cpp.
| void unravel::text_component::set_area | ( | const fsize_t & | area | ) |
Sets the area bounds for text rendering.
| area | The width and height of the text area |
Definition at line 1215 of file text_component.cpp.
| void unravel::text_component::set_auto_size | ( | bool | auto_size | ) |
Enables or disables automatic font sizing.
| auto_size | True to enable auto-sizing, false to disable |
Definition at line 1146 of file text_component.cpp.
| void unravel::text_component::set_auto_size_range | ( | const urange32_t & | range | ) |
Sets the range for automatic font sizing.
| range | The minimum and maximum font sizes allowed |
Definition at line 1231 of file text_component.cpp.
| void unravel::text_component::set_buffer_type | ( | const buffer_type & | type | ) |
Sets the buffer type for text rendering.
| type | The buffer_type to use (static, dynamic, or transient) |
Definition at line 953 of file text_component.cpp.
| void unravel::text_component::set_font | ( | const asset_handle< font > & | font | ) |
Sets the font to be used for rendering text.
| font | Asset handle to the font resource |
Definition at line 981 of file text_component.cpp.
| void unravel::text_component::set_font_size | ( | uint32_t | font_size | ) |
Sets the font size in pixels.
| font_size | The size in pixels |
Definition at line 1130 of file text_component.cpp.
| void unravel::text_component::set_is_rich_text | ( | bool | is_rich | ) |
Enables or disables rich text processing.
| is_rich | True to enable rich text processing, false for plain text |
Definition at line 1167 of file text_component.cpp.
| void unravel::text_component::set_overflow_type | ( | const overflow_type & | type | ) |
Sets how text should overflow when it exceeds its bounds.
| type | The overflow_type to use (none, word, or grapheme) |
Definition at line 967 of file text_component.cpp.
| void unravel::text_component::set_style | ( | const text_style & | style | ) |
Sets the text styling properties.
| style | The text_style object containing all styling properties |
Definition at line 938 of file text_component.cpp.
| void unravel::text_component::set_text | ( | const std::string & | text | ) |
Sets the text content to be rendered.
| text | The string content to be displayed |
Definition at line 923 of file text_component.cpp.
| void unravel::text_component::submit | ( | gfx::view_id | id, |
| const math::transform & | world, | ||
| uint64_t | state ) |
Submits the text for rendering.
| id | The view ID for rendering |
| world | The world transform matrix |
| state | The rendering state flags |
Definition at line 1360 of file text_component.cpp.