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 } |
![]() | |
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. | |
![]() | |
void | touch () |
Marks the component as 'touched'. | |
Additional Inherited Members | |
![]() | |
bool | eto {} |
Disable empty type optimizations. | |
![]() | |
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 1320 of file text_component.cpp.
auto unravel::text_component::get_alignment | ( | ) | const -> const alignment& |
Gets the current text alignment settings.
Definition at line 1214 of file text_component.cpp.
auto unravel::text_component::get_apply_kerning | ( | ) | const -> bool |
Checks if kerning is enabled.
Definition at line 1198 of file text_component.cpp.
auto unravel::text_component::get_area | ( | ) | const -> const fsize_t& |
Gets the current text area bounds.
Definition at line 1230 of file text_component.cpp.
auto unravel::text_component::get_auto_size | ( | ) | const -> bool |
Checks if auto-sizing is enabled.
Definition at line 1161 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 1246 of file text_component.cpp.
auto unravel::text_component::get_bounds | ( | ) | const -> math::bbox |
Gets the bounding box of the text.
Definition at line 1251 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 1145 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 1182 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 1286 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 1328 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 1266 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 1281 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 1166 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 1311 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 1315 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 1203 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 1187 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 1219 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 1150 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 1235 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 1134 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 1171 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 1364 of file text_component.cpp.