6#include <hpp/small_vector.hpp>
41template<
typename T,
size_t StaticCapacity = 16>
98 constexpr float epsilon = 0.0001f;
99 return std::fabs(
opacity - other.opacity) < epsilon &&
206 void set_text(
const std::string& text);
415 void submit(
gfx::view_id
id, const
math::transform& world, uint64_t state);
419 void recreate_scaled_font() const;
420 void recreate_text() const;
424 mutable uintptr_t font_version_{};
425 mutable bool scaled_font_dirty_{
true};
427 mutable std::shared_ptr<scaled_font> scaled_font_;
430 bool apply_kerning_{
true};
433 mutable bool text_dirty_{
true};
435 uint32_t font_size_{36};
436 mutable uint32_t calculated_font_size_{};
444 mutable bool align_dirty_{
true};
451 std::shared_ptr<text_buffer_builder> builder_ = std::make_shared<text_buffer_builder>();
452 std::shared_ptr<text_buffer_builder> debug_builder_ = std::make_shared<text_buffer_builder>();
454 mutable scratch_cache scratch_{};
void set_buffer_type(const buffer_type &type)
Sets the buffer type for text rendering.
auto get_style() const -> const text_style &
Gets the current text style settings.
auto get_apply_kerning() const -> bool
Checks if kerning is enabled.
auto get_area() const -> const fsize_t &
Gets the current text area bounds.
void set_alignment(const alignment &align)
Sets the text alignment properties.
auto get_render_font_size() const -> uint32_t
Gets the actual font size being used for rendering.
void set_font(const asset_handle< font > &font)
Sets the font to be used for rendering text.
auto get_auto_size() const -> bool
Checks if auto-sizing is enabled.
auto get_auto_size_range() const -> const urange32_t &
Gets the current auto-size range.
auto get_font_size() const -> uint32_t
Gets the current font size.
auto get_bounds() const -> math::bbox
Gets the bounding box of the text.
auto get_lines(bool include_breaks=true) const -> text_vector< text_line >
Gets the text content split into lines.
auto get_font() const -> const asset_handle< font > &
Gets the current font.
void set_area(const fsize_t &area)
Sets the area bounds for text rendering.
void set_is_rich_text(bool is_rich)
Enables or disables rich text processing.
auto get_text() const -> const std::string &
Gets the current text content.
void set_overflow_type(const overflow_type &type)
Sets how text should overflow when it exceeds its bounds.
auto get_alignment() const -> const alignment &
Gets the current text alignment settings.
auto get_is_rich_text() const -> bool
Checks if rich text processing is enabled.
auto meters_to_px(float meters) const -> float
Converts meters to pixels based on current font metrics.
auto get_render_area() const -> fsize_t
Gets the actual area used for rendering.
void set_text(const std::string &text)
Sets the text content to be rendered.
auto get_scaled_font() const -> const scaled_font &
Gets the scaled font instance used for rendering.
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 set_auto_size(bool auto_size)
Enables or disables automatic font sizing.
void set_font_size(uint32_t font_size)
Sets the font size in pixels.
auto get_render_bounds() const -> math::bbox
Gets the bounding box used for rendering.
auto get_overflow_type() const -> const overflow_type &
Gets the current overflow handling type.
void set_auto_size_range(const urange32_t &range)
Sets the range for automatic font sizing.
auto get_render_buffers_count() const -> size_t
Gets the number of render buffers being used.
auto get_buffer_type() const -> const buffer_type &
Gets the current buffer type.
auto can_be_rendered() const -> bool
Checks if the text can be rendered.
void set_style(const text_style &style)
Sets the text styling properties.
void set_apply_kerning(bool apply_kerning)
Enables or disables kerning in text rendering.
text_vector< word_frag > fragment_list
text_vector< rich_segment > segment_list
hpp::small_vector< T, StaticCapacity > text_vector
text_vector< wrapped_line > text_layout
Represents a handle to an asset, providing access and management functions.
static color transparent()
CRTP (Curiously Recurring Template Pattern) base structure for components.
text_vector< word_frag > parts
text_vector< frag_atom > atoms
text_vector< char, 256 > wb
text_vector< size_t > offsets
text_vector< char, 256 > lb
auto operator==(const text_style &other) const -> bool
void set_opacity(float opacity)
auto get_background_color() const -> math::color
void set_overline_color(math::color color)
auto get_opacity() const -> float
void set_shadow_color(math::color color)
auto get_underline_color() const -> math::color
void set_foreground_color(math::color color)
void set_text_color(math::color color)
auto get_shadow_color() const -> math::color
uint32_t foreground_color
void set_strike_color(math::color color)
void set_background_color(math::color color)
auto get_strike_color() const -> math::color
void set_outline_color(math::color color)
void set_style_flags(text_style_flags flags)
math::vec2 shadow_offsets
void set_underline_color(math::color color)
auto get_overline_color() const -> math::color
auto get_outline_color() const -> math::color
uint32_t background_color
auto get_foreground_color() const -> math::color
auto get_style_flags() const -> text_style_flags
auto get_text_color() const -> math::color
std::string_view brk_symbol
hpp::string_view brk_symbol
text_vector< rich_segment > segments