.. index:: pair: class; EE::Graphics::RichText .. _doxid-class_e_e_1_1_graphics_1_1_rich_text: class EE::Graphics::RichText ============================ .. toctree:: :hidden: struct_EE_Graphics_RichText_RenderParagraph.rst struct_EE_Graphics_RichText_RenderSpan.rst Overview ~~~~~~~~ A drawable class that renders rich text with multiple styles and spans. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class RichText: public :ref:`EE::Graphics::Drawable` { public: // structs struct :ref:`RenderParagraph`; struct :ref:`RenderSpan`; // construction :ref:`~RichText`(); // methods static RichText* :ref:`New`(); void :ref:`addSpan`(const :ref:`String`& text, const :ref:`FontStyleConfig`& style); void :ref:`addSpan`(const :ref:`String`& text, :ref:`Font`* font = nullptr, :ref:`Uint32` characterSize = 0, :ref:`Color` color = Color::White, :ref:`Uint32` style = :ref:`Text::Regular`); void :ref:`clear`(); void :ref:`setFontStyleConfig`(const :ref:`FontStyleConfig`& styleConfig); :ref:`FontStyleConfig`& :ref:`getFontStyleConfig`(); void :ref:`setAlign`(:ref:`Uint32` align); void :ref:`setMaxWidth`(:ref:`Float` width); :ref:`Float` :ref:`getMaxWidth`() const; std::vector`>>& :ref:`getSpans`(); virtual void :target:`draw`( const :ref:`Float`& X, const :ref:`Float`& Y, const :ref:`Vector2f`& scale = Vector2f::One, const :ref:`Float`& rotation = 0, :ref:`BlendMode` effect = :ref:`BlendMode::Alpha`(), const :ref:`OriginPoint`& rotationCenter = OriginPoint::OriginCenter, const :ref:`OriginPoint`& scaleCenter = OriginPoint::OriginCenter ); virtual void :target:`draw`(); virtual void :target:`draw`(const :ref:`Vector2f`& position); virtual void :target:`draw`(const :ref:`Vector2f`& position, const :ref:`Sizef`& size); virtual bool :target:`isStateful`(); virtual :ref:`Sizef` :target:`getSize`(); virtual :ref:`Sizef` :target:`getPixelsSize`(); void :ref:`invalidate`(); const std::vector<:ref:`RenderParagraph`>& :ref:`getLines`() const; }; Inherited Members ----------------- .. ref-code-block:: cpp :class: doxyrest-overview-inherited-code-block public: // enums enum :ref:`Type`; // methods virtual :ref:`Sizef` :ref:`getSize`() = 0; virtual :ref:`Sizef` :ref:`getPixelsSize`() = 0; virtual void :ref:`draw`() = 0; virtual void :ref:`draw`(const :ref:`Vector2f`& position) = 0; virtual void :ref:`draw`(const :ref:`Vector2f`& position, const :ref:`Sizef`& size) = 0; virtual bool :ref:`isStateful`() = 0; void :ref:`setAlpha`(:ref:`Uint8` alpha); const :ref:`Uint8`& :ref:`getAlpha`(); void :ref:`setColor`(const :ref:`Color`& color); const :ref:`Color`& :ref:`getColor`() const; void :ref:`setColorFilter`(const :ref:`Color`& color); :ref:`RGB` :ref:`getColorFilter`(); void :ref:`clearColor`(); void :ref:`clearColorFilter`(); void :ref:`resetAlpha`(); :ref:`Type` :ref:`getDrawableType`() const; const :ref:`Vector2f`& :ref:`getPosition`() const; void :ref:`setPosition`(const :ref:`Vector2f`& position); virtual bool :ref:`isDrawableResource`() const; .. _details-class_e_e_1_1_graphics_1_1_rich_text: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ A drawable class that renders rich text with multiple styles and spans. :ref:`RichText ` allows rendering text with different fonts, sizes, colors, and styles mixed together. It supports word wrapping and alignment. Construction ------------ .. _doxid-class_e_e_1_1_graphics_1_1_rich_text_1ab561dff9f07532229642970cfd0adfcd: .. ref-code-block:: cpp :class: doxyrest-title-code-block ~RichText() Destructor. Methods ------- .. index:: pair: function; New .. _doxid-class_e_e_1_1_graphics_1_1_rich_text_1a7636c5820b741b8e58f4533ecc35cab6: .. ref-code-block:: cpp :class: doxyrest-title-code-block static RichText* New() .. rubric:: Returns: A new instance of :ref:`RichText `. .. index:: pair: function; addSpan .. _doxid-class_e_e_1_1_graphics_1_1_rich_text_1a9c53608738f111a83cd0e6782e9ee0b9: .. ref-code-block:: cpp :class: doxyrest-title-code-block void addSpan(const :ref:`String`& text, const :ref:`FontStyleConfig`& style) Adds a text span with a specific style configuration. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - text - The text content. * - style - The font style configuration to apply. .. index:: pair: function; addSpan .. _doxid-class_e_e_1_1_graphics_1_1_rich_text_1a57d8f632df1377a90b851007f2912252: .. ref-code-block:: cpp :class: doxyrest-title-code-block void addSpan(const :ref:`String`& text, :ref:`Font`* font = nullptr, :ref:`Uint32` characterSize = 0, :ref:`Color` color = Color::White, :ref:`Uint32` style = :ref:`Text::Regular`) Adds a text span with individual style parameters. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - text - The text content. * - font - The font to use (optional, uses default if null). * - characterSize - The character size (optional, uses default if 0). * - color - The text color (optional, uses default if White). * - style - The text style (optional, uses default if Regular). .. index:: pair: function; clear .. _doxid-class_e_e_1_1_graphics_1_1_rich_text_1aac024dce521ee6f8da375465a40fa27a: .. ref-code-block:: cpp :class: doxyrest-title-code-block void clear() Clears all text spans. .. index:: pair: function; setFontStyleConfig .. _doxid-class_e_e_1_1_graphics_1_1_rich_text_1a9538c20e577d4dd0ab4a69042f7fa3f0: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setFontStyleConfig(const :ref:`FontStyleConfig`& styleConfig) Sets the default font style configuration used for new spans if not specified. .. index:: pair: function; getFontStyleConfig .. _doxid-class_e_e_1_1_graphics_1_1_rich_text_1a0e07a4d8add3564bbf28333c04b441be: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`FontStyleConfig`& getFontStyleConfig() .. rubric:: Returns: The default font style configuration. .. index:: pair: function; setAlign .. _doxid-class_e_e_1_1_graphics_1_1_rich_text_1ab6cbc843b8fb711ab62c8695996a8254: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setAlign(:ref:`Uint32` align) Sets the text alignment (Left, Center, Right). .. index:: pair: function; setMaxWidth .. _doxid-class_e_e_1_1_graphics_1_1_rich_text_1a87fa4e5f8beb6989b142d7196674ddc0: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setMaxWidth(:ref:`Float` width) Sets the maximum width for wrapping. If 0, wrapping is disabled. .. index:: pair: function; getMaxWidth .. _doxid-class_e_e_1_1_graphics_1_1_rich_text_1ac0a75605be30033edd4e168d2e6328b2: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Float` getMaxWidth() const .. rubric:: Returns: The maximum width for wrapping. .. index:: pair: function; getSpans .. _doxid-class_e_e_1_1_graphics_1_1_rich_text_1a137efb75dbc97f422b2b85900705e33f: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector`>>& getSpans() .. rubric:: Returns: The list of text spans. .. index:: pair: function; invalidate .. _doxid-class_e_e_1_1_graphics_1_1_rich_text_1a99359cf86f2f10391abc5b80745cc8b6: .. ref-code-block:: cpp :class: doxyrest-title-code-block void invalidate() Invalidates the layout, forcing a recalculation on the next update. .. index:: pair: function; getLines .. _doxid-class_e_e_1_1_graphics_1_1_rich_text_1ae04f4c2e8c6e0b54c665140569511936: .. ref-code-block:: cpp :class: doxyrest-title-code-block const std::vector<:ref:`RenderParagraph`>& getLines() const .. rubric:: Returns: The list of rendered lines.