.. index:: pair: class; EE::Graphics::Text .. _doxid-class_e_e_1_1_graphics_1_1_text: class EE::Graphics::Text ======================== .. toctree:: :hidden: enum_EE_Graphics_Text_Style.rst struct_EE_Graphics_Text_VertexCoords.rst Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class Text { public: // typedefs typedef std::function`)> :ref:`VisualLineCallback`; // enums enum :ref:`Style`; // structs struct :ref:`VertexCoords`; // fields static bool :target:`TextShaperEnabled`; static bool :target:`TextShaperOptimizations`; static :ref:`Uint32` :target:`GlobalInvalidationId`; // construction :target:`Text`(); :target:`Text`(const :ref:`String`& string, :ref:`Font`* font, unsigned int characterSize = :ref:`PixelDensity::dpToPx`(12)); :target:`Text`(:ref:`Font`* font, unsigned int characterSize = :ref:`PixelDensity::dpToPx`(12)); // methods static bool :target:`canSkipShaping`(:ref:`Uint32` textDrawHints); static :ref:`Float` :target:`tabAdvance`(:ref:`Float` spaceHorizontalAdvance, :ref:`Uint32` tabLength, std::optional<:ref:`Float`> tabOffset); static std::string :target:`styleFlagToString`(const :ref:`Uint32`& flags); static :ref:`Uint32` :target:`stringToStyleFlag`(const std::string& str); static :ref:`Float` :target:`getTextWidth`( :ref:`Font`* font, const :ref:`Uint32`& fontSize, const :ref:`String`& string, const :ref:`Uint32`& style, const :ref:`Uint32`& tabWidth = 4, const :ref:`Float`& outlineThickness = 0.f, :ref:`Uint32` textDrawHints = 0, :ref:`TextDirection` direction = :ref:`TextDirection::Unspecified`, std::optional<:ref:`Float`> tabOffset = {} ); static :ref:`Float` :target:`getTextWidth`( :ref:`Font`* font, const :ref:`Uint32`& fontSize, const :ref:`String::View`& string, const :ref:`Uint32`& style, const :ref:`Uint32`& tabWidth = 4, const :ref:`Float`& outlineThickness = 0.f, :ref:`Uint32` textDrawHints = 0, :ref:`TextDirection` direction = :ref:`TextDirection::Unspecified`, std::optional<:ref:`Float`> tabOffset = {} ); static :ref:`Float` :target:`getTextWidth`(const :ref:`String`& string, const :ref:`FontStyleConfig`& config, const :ref:`Uint32`& tabWidth = 4, :ref:`Uint32` textDrawHints = 0, :ref:`TextDirection` direction = :ref:`TextDirection::Unspecified`, std::optional<:ref:`Float`> tabOffset = {}); static :ref:`Float` :target:`getTextWidth`(const :ref:`String::View`& string, const :ref:`FontStyleConfig`& config, const :ref:`Uint32`& tabWidth = 4, :ref:`Uint32` textDrawHints = 0, :ref:`TextDirection` direction = :ref:`TextDirection::Unspecified`, std::optional<:ref:`Float`> tabOffset = {}); static :ref:`Sizef` :target:`draw`( const :ref:`String`& string, const :ref:`Vector2f`& pos, :ref:`Font`* font, :ref:`Float` fontSize, const :ref:`Color`& fontColor, :ref:`Uint32` style = 0, :ref:`Float` outlineThickness = 0.f, const :ref:`Color`& outlineColor = Color::Black, const :ref:`Color`& shadowColor = Color::Black, const :ref:`Vector2f`& shadowOffset = { 1, 1 }, const :ref:`Uint32`& tabWidth = 4, :ref:`Uint32` textDrawHints = 0, :ref:`TextDirection` direction = :ref:`TextDirection::Unspecified`, const :ref:`WhitespaceDisplayConfig`& whitespaceDisplayConfig = {} ); static :ref:`Sizef` :target:`draw`( const :ref:`String`& string, const :ref:`Vector2f`& pos, const :ref:`FontStyleConfig`& config, const :ref:`Uint32`& tabWidth = 4, :ref:`Uint32` textDrawHints = 0, :ref:`TextDirection` direction = :ref:`TextDirection::Unspecified`, const :ref:`WhitespaceDisplayConfig`& whitespaceDisplayConfig = {} ); static :ref:`Sizef` :target:`draw`( const :ref:`String::View`& string, const :ref:`Vector2f`& pos, :ref:`Font`* font, :ref:`Float` fontSize, const :ref:`Color`& fontColor, :ref:`Uint32` style = 0, :ref:`Float` outlineThickness = 0.f, const :ref:`Color`& outlineColor = Color::Black, const :ref:`Color`& shadowColor = Color::Black, const :ref:`Vector2f`& shadowOffset = { 1, 1 }, const :ref:`Uint32`& tabWidth = 4, :ref:`Uint32` textDrawHints = 0, :ref:`TextDirection` direction = :ref:`TextDirection::Unspecified`, const :ref:`WhitespaceDisplayConfig`& whitespaceDisplayConfig = {} ); static :ref:`Sizef` :target:`draw`( const :ref:`String::View`& string, const :ref:`Vector2f`& pos, const :ref:`FontStyleConfig`& config, const :ref:`Uint32`& tabWidth = 4, :ref:`Uint32` textDrawHints = 0, :ref:`TextDirection` direction = :ref:`TextDirection::Unspecified`, const :ref:`WhitespaceDisplayConfig`& whitespaceDisplayConfig = {} ); static void :target:`drawUnderline`( const :ref:`Vector2f`& pos, :ref:`Float` width, :ref:`Font`* font, :ref:`Float` fontSize, const :ref:`Color`& fontColor, const :ref:`Uint32`& style, :ref:`Float` outlineThickness, const :ref:`Color`& outlineColor, const :ref:`Color`& shadowColor, const :ref:`Vector2f`& shadowOffset ); static void :target:`drawStrikeThrough`( const :ref:`Vector2f`& pos, :ref:`Float` width, :ref:`Font`* font, :ref:`Float` fontSize, const :ref:`Color`& fontColor, const :ref:`Uint32`& style, :ref:`Float` outlineThickness, const :ref:`Color`& outlineColor, const :ref:`Color`& shadowColor, const :ref:`Vector2f`& shadowOffset ); static :ref:`Int32` :target:`findCharacterFromPos`( const :ref:`Vector2i`& pos, bool returnNearest, :ref:`Font`* font, const :ref:`Uint32`& fontSize, const :ref:`String`& string, const :ref:`Uint32`& style, const :ref:`Uint32`& tabWidth = 4, const :ref:`Float`& outlineThickness = 0.f, std::optional<:ref:`Float`> tabOffset = {}, :ref:`Uint32` textHints = 0, :ref:`TextDirection` direction = :ref:`TextDirection::Unspecified`, const :ref:`Vector2f`& initialOffset = {} ); static :ref:`Vector2f` :target:`findCharacterPos`( std::size_t index, :ref:`Font`* font, const :ref:`Uint32`& fontSize, const :ref:`String`& string, const :ref:`Uint32`& style, const :ref:`Uint32`& tabWidth = 4, const :ref:`Float`& outlineThickness = 0.f, std::optional<:ref:`Float`> tabOffset = {}, bool allowNewLine = true, :ref:`Uint32` textHints = 0, :ref:`TextDirection` direction = :ref:`TextDirection::Unspecified`, const :ref:`Vector2f`& initialOffset = {} ); static std::size_t :target:`findLastCharPosWithinLength`( :ref:`Font`* font, const :ref:`Uint32`& fontSize, const :ref:`String`& string, :ref:`Float` maxWidth, const :ref:`Uint32`& style, const :ref:`Uint32`& tabWidth = 4, const :ref:`Float`& outlineThickness = 0.f, std::optional<:ref:`Float`> tabOffset = {}, :ref:`Uint32` textHints = 0, :ref:`TextDirection` direction = :ref:`TextDirection::Unspecified` ); static std::size_t :target:`findLastCharPosWithinLength`( :ref:`Font`* font, const :ref:`Uint32`& fontSize, const :ref:`String::View`& string, :ref:`Float` maxWidth, const :ref:`Uint32`& style, const :ref:`Uint32`& tabWidth = 4, const :ref:`Float`& outlineThickness = 0.f, std::optional<:ref:`Float`> tabOffset = {}, :ref:`Uint32` textHints = 0, :ref:`TextDirection` direction = :ref:`TextDirection::Unspecified` ); static std::size_t :target:`findLastCharPosWithinLength`( const :ref:`String`& string, :ref:`Float` maxWidth, const :ref:`FontStyleConfig`& config, const :ref:`Uint32`& tabWidth = 4, std::optional<:ref:`Float`> tabOffset = {}, :ref:`Uint32` textHints = 0, :ref:`TextDirection` direction = :ref:`TextDirection::Unspecified` ); static std::size_t :target:`findLastCharPosWithinLength`( const :ref:`String::View`& string, :ref:`Float` maxWidth, const :ref:`FontStyleConfig`& config, const :ref:`Uint32`& tabWidth = 4, std::optional<:ref:`Float`> tabOffset = {}, :ref:`Uint32` textHints = 0, :ref:`TextDirection` direction = :ref:`TextDirection::Unspecified` ); static bool :target:`hardWrapText`( :ref:`Font`* font, const :ref:`Uint32`& fontSize, :ref:`String`& string, const :ref:`Float`& maxWidth, const :ref:`Uint32`& style, const :ref:`Uint32`& tabWidth = 4, const :ref:`Float`& outlineThickness = 0.f, std::optional<:ref:`Float`> tabOffset = {}, :ref:`Uint32` textHints = 0 ); static bool :target:`hardWrapText`(:ref:`String`& string, const :ref:`Float`& maxWidth, const :ref:`FontStyleConfig`& config, const :ref:`Uint32`& tabWidth = 4, std::optional<:ref:`Float`> tabOffset = {}, :ref:`Uint32` textHints = 0); static Text* :target:`New`(); static Text* :target:`New`(const :ref:`String`& string, :ref:`Font`* font, unsigned int characterSize = :ref:`PixelDensity::dpToPx`(12)); static Text* :target:`New`(:ref:`Font`* font, unsigned int characterSize = :ref:`PixelDensity::dpToPx`(12)); void :ref:`create`(:ref:`Graphics::Font`* font, const :ref:`String`& text = "", :ref:`Color` FontColor = :ref:`Color`(255, 255, 255, 255), :ref:`Color` FontShadowColor = :ref:`Color`(0, 0, 0, 255), :ref:`Uint32` characterSize = :ref:`PixelDensity::dpToPx`(12)); bool :target:`setString`(const :ref:`String::View`& string); bool :target:`setString`(const :ref:`String`& string); bool :target:`setString`(:ref:`String`&& string); void :target:`setFont`(:ref:`Font`* font); void :target:`setFontSize`(unsigned int size); void :target:`setStyle`(:ref:`Uint32` style); void :target:`setColor`(const :ref:`Color`& color); void :target:`setFillColor`(const :ref:`Color`& color); void :target:`setFillColor`(const :ref:`Color`& color, :ref:`Uint32` from, :ref:`Uint32` to); void :target:`setFillColor`(const std::vector<:ref:`Color`>& colors); void :target:`setOutlineColor`(const :ref:`Color`& color); void :target:`setOutlineThickness`(:ref:`Float` thickness); void :target:`transformText`(const :ref:`TextTransform::Value`& transform); const :ref:`String`& :target:`getString`() const; :ref:`String`& :target:`getString`(); :ref:`Font`* :target:`getFont`() const; unsigned int :target:`getCharacterSize`() const; :ref:`Uint32` :target:`getStyle`() const; void :ref:`setAlpha`(const :ref:`Uint8`& alpha); const :ref:`Color`& :target:`getFillColor`() const; const :ref:`Color`& :target:`getColor`() const; const :ref:`Color`& :target:`getOutlineColor`() const; :ref:`Float` :target:`getOutlineThickness`() const; :ref:`Vector2f` :target:`findCharacterPos`(std::size_t index) const; :ref:`Rectf` :ref:`getLocalBounds`(); :ref:`Float` :ref:`getTextWidth`(); :ref:`Float` :ref:`getTextHeight`(); :ref:`Float` :ref:`getLineSpacing`(); void :ref:`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 ); const :ref:`Color`& :ref:`getShadowColor`() const; void :ref:`setShadowColor`(const :ref:`Color`& color); const std::vector<:ref:`Float`>& :ref:`getLinesWidth`(); :ref:`Float` :ref:`getLastLineWidth`(); void :ref:`setAlign`(const :ref:`Uint32`& align); const :ref:`Uint32`& :ref:`getAlign`() const; :ref:`Uint32` :ref:`getNumLines`(); void :target:`setStyleConfig`(const :ref:`FontStyleConfig`& styleConfig); :ref:`Int32` :ref:`findCharacterFromPos`(const :ref:`Vector2i`& pos, bool returnNearest = true) const; void :ref:`findWordFromCharacterIndex`(:ref:`Int32` characterIndex, :ref:`Int32`& initCur, :ref:`Int32`& endCur) const; void :ref:`hardWrapText`(const :ref:`Uint32`& maxWidth); void :ref:`invalidateColors`(); void :ref:`invalidate`(); void :ref:`setTabWidth`(const :ref:`Uint32`& tabWidth); const :ref:`Uint32`& :ref:`getTabWidth`() const; :ref:`Color` :ref:`getBackgroundColor`() const; void :ref:`setBackgroundColor`(const :ref:`Color`& backgroundColor); bool :ref:`getDisableCacheWidth`() const; void :ref:`setDisableCacheWidth`(bool newDisableCacheWidth); const :ref:`Vector2f`& :target:`getShadowOffset`() const; void :target:`setShadowOffset`(const :ref:`Vector2f`& shadowOffset); bool :target:`hasSameFontStyleConfig`(const :ref:`FontStyleConfig`& styleConfig); void :target:`setTabStops`(bool enabled); bool :target:`hasTabStops`() const; const :ref:`FontStyleConfig`& :target:`getFontStyleConfig`() const; :ref:`Uint32` :target:`getTextHints`() const; void :target:`setTextHints`(:ref:`Uint32` textHints); void :target:`setDirection`(:ref:`TextDirection` direction); :ref:`TextDirection` :target:`getDirection`() const; void :ref:`setInitialOffset`(const :ref:`Vector2f`& offset); const :ref:`Vector2f`& :ref:`getInitialOffset`() const; void :ref:`setLineWrapMode`(:ref:`LineWrapMode` mode); :ref:`LineWrapMode` :ref:`getLineWrapMode`() const; void :ref:`setMaxWrapWidth`(:ref:`Float` maxWidth); :ref:`Float` :ref:`getMaxWrapWidth`() const; void :ref:`setLineWrapKeepIndentation`(bool keep); bool :ref:`getLineWrapKeepIndentation`() const; :ref:`Uint32` :ref:`getVisualLineCount`(); void :ref:`forEachVisualLine`(const :ref:`VisualLineCallback`& callback); size_t :ref:`findVisualLineFromCharIndex`(size_t charIndex); std::vector<:ref:`Rectf`> :ref:`getSelectionRects`(:ref:`TextSelectionRange` range); }; .. _details-class_e_e_1_1_graphics_1_1_text: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Typedefs -------- .. index:: pair: typedef; VisualLineCallback .. _doxid-class_e_e_1_1_graphics_1_1_text_1a0fd889793a432cc6479b510f3c873d02: .. ref-code-block:: cpp :class: doxyrest-title-code-block typedef std::function`)> VisualLineCallback Callback type for iterating over visual lines. Parameters: visual line index, start char index, end char index (exclusive), line width Methods ------- .. index:: pair: function; create .. _doxid-class_e_e_1_1_graphics_1_1_text_1aaa35c4949d16c835e8554a52fdae9d5e: .. ref-code-block:: cpp :class: doxyrest-title-code-block void create(:ref:`Graphics::Font`* font, const :ref:`String`& text = "", :ref:`Color` FontColor = :ref:`Color`(255, 255, 255, 255), :ref:`Color` FontShadowColor = :ref:`Color`(0, 0, 0, 255), :ref:`Uint32` characterSize = :ref:`PixelDensity::dpToPx`(12)) Create a text from a font .. index:: pair: function; setAlpha .. _doxid-class_e_e_1_1_graphics_1_1_text_1ac856a5d67f8111f55b36cd55ca13ad85: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setAlpha(const :ref:`Uint8`& alpha) .. rubric:: See also: Set the alpha of each individual character. This doesn't break any custom color per-character set. .. index:: pair: function; getLocalBounds .. _doxid-class_e_e_1_1_graphics_1_1_text_1a27e4db66f138bf92f67bc217f76f23e9: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Rectf` getLocalBounds() .. rubric:: Returns: The current text local bounds. .. index:: pair: function; getTextWidth .. _doxid-class_e_e_1_1_graphics_1_1_text_1ab06242b58ccb65f91fb1b44576413d40: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Float` getTextWidth() .. rubric:: Returns: The cached text width .. index:: pair: function; getTextHeight .. _doxid-class_e_e_1_1_graphics_1_1_text_1a54d9596ee8a657281532995bf15c6f53: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Float` getTextHeight() .. rubric:: Returns: The cached text height .. index:: pair: function; getLineSpacing .. _doxid-class_e_e_1_1_graphics_1_1_text_1af7f745265fd8dbf51b28e47c31e108d7: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Float` getLineSpacing() .. rubric:: Returns: The line spacing .. index:: pair: function; draw .. _doxid-class_e_e_1_1_graphics_1_1_text_1a1d775801bbece3079f1fd1aa02a28472: .. ref-code-block:: cpp :class: doxyrest-title-code-block void 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 ) Draw the cached text on screen .. index:: pair: function; getShadowColor .. _doxid-class_e_e_1_1_graphics_1_1_text_1a2d0c32dada22a65b8fa91049ec5d2a4b: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Color`& getShadowColor() const .. rubric:: Returns: The Shadow :ref:`Font ` Color .. index:: pair: function; setShadowColor .. _doxid-class_e_e_1_1_graphics_1_1_text_1acb07452d6e1f6950dec561cf038b0bfa: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setShadowColor(const :ref:`Color`& color) Set the shadow color of the string rendered .. index:: pair: function; getLinesWidth .. _doxid-class_e_e_1_1_graphics_1_1_text_1aa729d8d181866fc112642168deb912a4: .. ref-code-block:: cpp :class: doxyrest-title-code-block const std::vector<:ref:`Float`>& getLinesWidth() .. rubric:: Returns: Every cached text line width .. index:: pair: function; getLastLineWidth .. _doxid-class_e_e_1_1_graphics_1_1_text_1a4b080e16990dae189109a4b5202a689d: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Float` getLastLineWidth() .. rubric:: Returns: The last line width .. index:: pair: function; setAlign .. _doxid-class_e_e_1_1_graphics_1_1_text_1aa55f85f439489e1baf457714d585d33c: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setAlign(const :ref:`Uint32`& align) Set the text draw align .. index:: pair: function; getAlign .. _doxid-class_e_e_1_1_graphics_1_1_text_1a35aace55cf786f7d0d7a629aba667b8e: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Uint32`& getAlign() const .. rubric:: Returns: The text align .. index:: pair: function; getNumLines .. _doxid-class_e_e_1_1_graphics_1_1_text_1a6273b78cd3c0f114f19bc90665ca52d4: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Uint32` getNumLines() .. rubric:: Returns: The number of lines that the cached text contains .. index:: pair: function; findCharacterFromPos .. _doxid-class_e_e_1_1_graphics_1_1_text_1a83a0907badadbac18d5bd5c0d535aa64: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Int32` findCharacterFromPos(const :ref:`Vector2i`& pos, bool returnNearest = true) const Finds the closest cursor position to the point position .. index:: pair: function; findWordFromCharacterIndex .. _doxid-class_e_e_1_1_graphics_1_1_text_1a9b3968b46de15ec69b72a4622b7a95dd: .. ref-code-block:: cpp :class: doxyrest-title-code-block void findWordFromCharacterIndex(:ref:`Int32` characterIndex, :ref:`Int32`& initCur, :ref:`Int32`& endCur) const Simulates a selection request and return the initial and end cursor position when the selection worked. Otherwise both parameters will be -1. .. index:: pair: function; hardWrapText .. _doxid-class_e_e_1_1_graphics_1_1_text_1a61dc0ec5dcfc219486b830e791187a61: .. ref-code-block:: cpp :class: doxyrest-title-code-block void hardWrapText(const :ref:`Uint32`& maxWidth) Shrink the :ref:`String ` to a max width .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - MaxWidth - The maximum possible width .. index:: pair: function; invalidateColors .. _doxid-class_e_e_1_1_graphics_1_1_text_1a2837da74252e1ac3c6a3cb7fccc1e1fd: .. ref-code-block:: cpp :class: doxyrest-title-code-block void invalidateColors() Invalidates the color cache .. index:: pair: function; invalidate .. _doxid-class_e_e_1_1_graphics_1_1_text_1afa6fc7978360bf7030db39cbdaf383db: .. ref-code-block:: cpp :class: doxyrest-title-code-block void invalidate() Invalidates the text cache .. index:: pair: function; setTabWidth .. _doxid-class_e_e_1_1_graphics_1_1_text_1aac1f9bcb682ba091c4d152824d5ff2da: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setTabWidth(const :ref:`Uint32`& tabWidth) Sets the tab character width. .. index:: pair: function; getTabWidth .. _doxid-class_e_e_1_1_graphics_1_1_text_1acbd4a4b499ff314823ca4a576f80b66b: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Uint32`& getTabWidth() const .. rubric:: Returns: The tab character width .. index:: pair: function; getBackgroundColor .. _doxid-class_e_e_1_1_graphics_1_1_text_1a6fcd386f4b705bdf83fc3820ea5f42a0: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Color` getBackgroundColor() const .. rubric:: Returns: The text background color .. index:: pair: function; setBackgroundColor .. _doxid-class_e_e_1_1_graphics_1_1_text_1ac3b63a39e67acb7458d4af7e6eaad6b8: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setBackgroundColor(const :ref:`Color`& backgroundColor) Sets text background color. .. index:: pair: function; getDisableCacheWidth .. _doxid-class_e_e_1_1_graphics_1_1_text_1aa25237ec11a958bffaf1a7a33093f469: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool getDisableCacheWidth() const .. rubric:: Returns: True if the text width cache is disabled. .. index:: pair: function; setDisableCacheWidth .. _doxid-class_e_e_1_1_graphics_1_1_text_1a0c8aead94d1d44b1a4d88a18659582bd: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setDisableCacheWidth(bool newDisableCacheWidth) The text width is cached every time the geometry of the text is updated. It's possible to disable this to improve performance in very specific scenarios. .. index:: pair: function; setInitialOffset .. _doxid-class_e_e_1_1_graphics_1_1_text_1a94c253684202449147177bb3cdb9e68c: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setInitialOffset(const :ref:`Vector2f`& offset) Sets the initial position offset for this text. This is useful for :ref:`RichText ` where spans continue from a previous text segment. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - offset - The initial X/Y offset to apply to all position calculations .. index:: pair: function; getInitialOffset .. _doxid-class_e_e_1_1_graphics_1_1_text_1a6ff15dacb3ad601dddd5c765857d9126: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Vector2f`& getInitialOffset() const .. rubric:: Returns: The current initial position offset .. index:: pair: function; setLineWrapMode .. _doxid-class_e_e_1_1_graphics_1_1_text_1a179a8ca958b7e25ff60883a7adf637b4: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setLineWrapMode(:ref:`LineWrapMode` mode) Sets the line wrap mode for soft wrapping. When enabled, text will wrap at the specified max width without modifying the string. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - mode - The wrap mode (NoWrap, Letter, or Word) .. index:: pair: function; getLineWrapMode .. _doxid-class_e_e_1_1_graphics_1_1_text_1a8b9e5eea38bb7e74404a7524844c3f20: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`LineWrapMode` getLineWrapMode() const .. rubric:: Returns: The current line wrap mode .. index:: pair: function; setMaxWrapWidth .. _doxid-class_e_e_1_1_graphics_1_1_text_1a4b1c634035a3f6f1cfb294e435d960f4: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setMaxWrapWidth(:ref:`Float` maxWidth) Sets the maximum width for line wrapping. Only used when line wrap mode is not NoWrap. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - maxWidth - The maximum width in pixels before wrapping .. index:: pair: function; getMaxWrapWidth .. _doxid-class_e_e_1_1_graphics_1_1_text_1ac5647f2ac7575f11997d615f724c8550: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Float` getMaxWrapWidth() const .. rubric:: Returns: The current max wrap width .. index:: pair: function; setLineWrapKeepIndentation .. _doxid-class_e_e_1_1_graphics_1_1_text_1aea5afcf1932ce273478ee8a69d52777d: .. ref-code-block:: cpp :class: doxyrest-title-code-block void setLineWrapKeepIndentation(bool keep) Sets whether to preserve indentation on wrapped lines. .. index:: pair: function; getLineWrapKeepIndentation .. _doxid-class_e_e_1_1_graphics_1_1_text_1af3dcfcb7bf222274652a1ea1ba0fbf2f: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool getLineWrapKeepIndentation() const .. rubric:: Returns: Whether indentation is preserved on wrapped lines .. index:: pair: function; getVisualLineCount .. _doxid-class_e_e_1_1_graphics_1_1_text_1abcf8b1f966106405d82ef47de76b3123: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Uint32` getVisualLineCount() .. rubric:: Returns: The number of visual lines (considering soft wraps) .. index:: pair: function; forEachVisualLine .. _doxid-class_e_e_1_1_graphics_1_1_text_1afb10845da5fadb5d3a959c1cd2182247: .. ref-code-block:: cpp :class: doxyrest-title-code-block void forEachVisualLine(const :ref:`VisualLineCallback`& callback) Iterates over each visual line, calling the callback with line info. This is useful for selection drawing and other operations that need visual line info. .. index:: pair: function; findVisualLineFromCharIndex .. _doxid-class_e_e_1_1_graphics_1_1_text_1a37c1ffe868236480ef2786757e71e5be: .. ref-code-block:: cpp :class: doxyrest-title-code-block size_t findVisualLineFromCharIndex(size_t charIndex) Finds the visual line index that contains the given character index. .. index:: pair: function; getSelectionRects .. _doxid-class_e_e_1_1_graphics_1_1_text_1a2defa984b4ada5cd425bd05e466a5fa1: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector<:ref:`Rectf`> getSelectionRects(:ref:`TextSelectionRange` range) .. rubric:: Returns: A list of rectangles that cover the selection of the string, each rectangle has the line spacing height and covers the width of the selection.