Storage for text content and rendering properties.
More...
#include <headers/utility/graphic/text/text.hpp>
|
| std::shared_ptr< Font > | _font |
| | Shared pointer to the font used for rendering.
|
| |
| std::vector< std::shared_ptr< Mesh > > | _meshes |
| | Meshes associated with this renderable object.
|
| |
| Color32Bit | _color |
| | Text RGBA color.
|
| |
| PoseF | _pose |
| | World pose (position and orientation) of the text.
|
| |
Storage for text content and rendering properties.
Encapsulates all properties needed to render text, including content, font information and size.
Definition at line 72 of file text.hpp.
◆ Text() [1/3]
| utility::graphic::Text::Text |
( |
std::shared_ptr< RessourceProvider > |
ressourceProvider, |
|
|
const PoseF & |
pose, |
|
|
const Color32Bit & |
color, |
|
|
const std::string & |
content, |
|
|
uint32_t |
fontSize, |
|
|
const std::string & |
font |
|
) |
| |
Constructor.
This constructor initializes a Text object with the specified content, font size, and font path. It also takes references to a RessourceProvider and an SystemIO, which are used to load the necessary font resources for rendering the text.
- Parameters
-
| ressourceProvider | A reference to the RessourceProvider instance used to load font resources. |
| pose | The initial position and orientation for the text. |
| color | The initial color of the text. |
| content | The text content to be displayed. |
| fontSize | The font size in points for rendering the text. |
| font | The file path to the font resource to be used for rendering the text. |
Definition at line 32 of file text.cpp.
◆ Text() [2/3]
| utility::graphic::Text::Text |
( |
const Text & |
other | ) |
|
|
delete |
Copy constructor.
- Parameters
-
| other | The Text object to copy from. |
◆ Text() [3/3]
| utility::graphic::Text::Text |
( |
Text && |
other | ) |
|
|
defaultnoexcept |
Move constructor.
- Parameters
-
| other | The Text object to move from. |
◆ clearContent()
| Text & utility::graphic::Text::clearContent |
( |
void |
| ) |
|
|
inline |
Clear text content.
- Returns
- Reference to this Text instance for chaining.
Definition at line 252 of file text.hpp.
◆ empty()
| bool utility::graphic::Text::empty |
( |
void |
| ) |
const |
|
inlinenoexcept |
Check if text content is empty.
- Returns
- True if content has no characters.
Definition at line 234 of file text.hpp.
◆ getContent()
| const std::string & utility::graphic::Text::getContent |
( |
void |
| ) |
const |
Get the text content.
- Returns
- Reference to the text content string.
Definition at line 58 of file text.cpp.
◆ getFontFamily()
| const std::string & utility::graphic::Text::getFontFamily |
( |
void |
| ) |
const |
Get the font family (path) used for rendering the text.
This method returns the path to the font file that is currently being used to render the text. The font family is determined by the font file specified during the construction of the Text object or when the font is changed. It can be used to identify the font being used for rendering or to retrieve additional font information if needed.
- Returns
- A const reference to the string containing the path to the font file used for rendering the text.
Definition at line 53 of file text.cpp.
◆ getFontSize()
| uint32_t utility::graphic::Text::getFontSize |
( |
void |
| ) |
const |
Get the font size.
- Returns
- Font size in points.
Definition at line 70 of file text.cpp.
◆ getMesh()
| std::shared_ptr< Mesh > utility::graphic::Text::getMesh |
( |
| ) |
const |
Get the mesh for rendering the text.
This method returns a shared pointer to the Mesh object that represents the geometry of the text for rendering. The mesh is generated based on the current text content, font, and font size, and it is updated whenever the text properties change (e.g., when the content or font size is modified).
- Returns
- A shared pointer to the Mesh object for rendering the text.
Definition at line 48 of file text.cpp.
◆ getTextDimensions()
| graphic::SizeF utility::graphic::Text::getTextDimensions |
( |
void |
| ) |
const |
Get the dimensions of the rendered text.
This method calculates and returns the dimensions of the rendered text based on the current content, font, and font size. It uses the Font class to retrieve the glyph information for the text content and computes the overall width and height of the text as it would be rendered, which can be useful for layout and positioning purposes.
- Returns
- A SizeF containing the width and height of the rendered text.
Definition at line 84 of file text.cpp.
◆ hasFontPath()
| bool utility::graphic::Text::hasFontPath |
( |
void |
| ) |
const |
|
inlinenoexcept |
Check if font path is set.
- Returns
- True if a non-empty font path is configured.
Definition at line 243 of file text.hpp.
◆ operator!=()
| bool utility::graphic::Text::operator!= |
( |
const Text & |
other | ) |
const |
|
inline |
Inequality comparison.
- Parameters
-
| other | Text object to compare with. |
- Returns
- True when any property differs.
Definition at line 275 of file text.hpp.
◆ operator=() [1/2]
| Text & utility::graphic::Text::operator= |
( |
const Text & |
other | ) |
|
|
delete |
Copy assignment operator.
- Parameters
-
| other | The Text object to copy from. |
- Returns
- A reference to this Text object.
◆ operator=() [2/2]
| Text & utility::graphic::Text::operator= |
( |
Text && |
other | ) |
|
|
defaultnoexcept |
Move assignment operator.
- Parameters
-
| other | The Text object to move from. |
- Returns
- A reference to this Text object.
◆ operator==()
| bool utility::graphic::Text::operator== |
( |
const Text & |
other | ) |
const |
|
inline |
Equality comparison.
- Parameters
-
| other | Text object to compare with. |
- Returns
- True when the visible text state is equal.
Definition at line 263 of file text.hpp.
◆ setContent()
| Text & utility::graphic::Text::setContent |
( |
const std::string & |
content | ) |
|
Set the text content.
- Parameters
-
| content | The new text content. |
- Returns
- Reference to this Text instance for chaining.
Definition at line 63 of file text.cpp.
◆ setFontSize()
| Text & utility::graphic::Text::setFontSize |
( |
uint32_t |
fontSize | ) |
|
Set the font size.
- Parameters
-
| fontSize | Font size in points. |
- Returns
- Reference to this Text instance for chaining.
Definition at line 75 of file text.cpp.
◆ updateMesh()
| void utility::graphic::Text::updateMesh |
( |
void |
| ) |
|
|
protected |
Updates the mesh for rendering the text based on the current content, font, and font size.
This method regenerates the mesh geometry for the text whenever the content, font, or font size changes. It uses the Font class to retrieve the necessary glyph information and constructs a new Mesh object that represents the geometry of the text for rendering.
Definition at line 107 of file text.cpp.
◆ utf8ToCodepoints()
| std::vector< uint32_t > utility::graphic::Text::utf8ToCodepoints |
( |
const std::string & |
str | ) |
const |
|
protected |
Converts a UTF-8 encoded string to a string of Unicode code points.
This method takes a UTF-8 encoded string as input and converts it to a string of Unicode code points, which can be used for rendering text with the appropriate glyphs. It processes the UTF-8 encoding to extract the individual Unicode code points and returns them in a codePointString format, which is a vector of uint32_t values representing the Unicode code
- Parameters
-
| str | The UTF-8 encoded string to convert. |
- Returns
- A codePointString containing the Unicode code points extracted from the input UTF-8 string.
Definition at line 167 of file text.cpp.
◆ _font
| std::shared_ptr<Font> utility::graphic::Text::_font |
|
protected |
Shared pointer to the font used for rendering.
Definition at line 83 of file text.hpp.
The documentation for this class was generated from the following files: