|
utility 2026.2.0
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
|
Storage for text content and rendering properties. More...
#include <headers/utility/graphic/text/text.hpp>


Public Member Functions | |
| Text (std::shared_ptr< RessourceProvider > ressourceProvider, const PoseF &pose, const Color32Bit &color, const std::string &content, uint32_t fontSize, const std::string &font) | |
| Constructor. | |
| Text (const Text &other)=delete | |
| Copy constructor. | |
| Text (Text &&other) noexcept=default | |
| Move constructor. | |
| std::shared_ptr< Mesh > | getMesh () const |
| Get the mesh for rendering the text. | |
| const std::string & | getFontFamily (void) const |
| Get the font family (path) used for rendering the text. | |
| Text & | operator= (const Text &other)=delete |
| Copy assignment operator. | |
| Text & | operator= (Text &&other) noexcept=default |
| Move assignment operator. | |
| const std::string & | getContent (void) const |
| Get the text content. | |
| Text & | setContent (const std::string &content) |
| Set the text content. | |
| uint32_t | getFontSize (void) const |
| Get the font size. | |
| graphic::SizeF | getTextDimensions (void) const |
| Get the dimensions of the rendered text. | |
| Text & | setFontSize (uint32_t fontSize) |
| Set the font size. | |
| RenderableType | getRenderableType (void) const override |
| Get the RenderableType of this object. | |
| std::string | getMaterialName () const override |
| Get the material name. | |
| bool | empty (void) const noexcept |
| Check if text content is empty. | |
| bool | hasFontPath (void) const noexcept |
| Check if font path is set. | |
| Text & | clearContent (void) |
| Clear text content. | |
| bool | operator== (const Text &other) const |
| Equality comparison. | |
| bool | operator!= (const Text &other) const |
| Inequality comparison. | |
Public Member Functions inherited from utility::graphic::Renderable | |
| Renderable (const PoseF &pose, const Color32Bit &color) | |
| Default constructor for Renderable. | |
| virtual | ~Renderable ()=default |
| Virtual destructor for Renderable. | |
| Renderable & | setPose (const PoseF &pose) |
| Set the text pose. | |
| void | setPose (PoseF &&pose) |
| Set the text pose. | |
| const PoseF & | getPose (void) const |
| Get the text pose. | |
| glm::mat4 | getModelMatrix (void) const |
| Get the object-to-world model matrix of this renderable. | |
| Renderable & | setColor (const graphic::Color32Bit &color) |
| Set the text color. | |
| void | setColor (graphic::Color32Bit &&color) |
| Set the text color. | |
| const graphic::Color32Bit & | getColor (void) const |
| Get the text color.]. | |
| std::vector< std::shared_ptr< Mesh > > | getMeshes () const |
| Get the meshes associated with this renderable object. | |
Protected Member Functions | |
| void | updateMesh (void) |
| Updates the mesh for rendering the text based on the current content, font, and font size. | |
| codePointString | utf8ToCodepoints (const std::string &str) const |
| Converts a UTF-8 encoded string to a string of Unicode code points. | |
Protected Member Functions inherited from utility::logging::Loggable< Text, logging::DefaultLogger > | |
| Loggable (void) | |
| Construct a Loggable with the specified LoggerType. | |
| Loggable (Loggable &&other) noexcept | |
| Move constructor for Loggable. | |
| Loggable & | operator= (Loggable &&other) noexcept |
| Move assignment operator for Loggable. | |
| LoggerType & | getLogger (void) |
| Get the internal logger. | |
| LoggerType & | getLogger (void) const |
| Get the internal logger. | |
| virtual | ~Loggable (void)=default |
| Virtual destructor for proper cleanup. | |
Protected Attributes | |
| std::shared_ptr< Font > | _font |
| Shared pointer to the font used for rendering. | |
Protected Attributes inherited from utility::graphic::Renderable | |
| 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. | |
Additional Inherited Members | |
Public Types inherited from utility::graphic::Renderable | |
| enum class | RenderableType { Unknown = 0 , Model = 1 , Text = 3 , Mesh = 4 } |
Storage for text content and rendering properties.
Encapsulates all properties needed to render text, including content, font information and size.
| 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.
| 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.

|
delete |
Copy constructor.
| other | The Text object to copy from. |
|
defaultnoexcept |
Move constructor.
| other | The Text object to move from. |
|
inline |
|
inlinenoexcept |
| const std::string & utility::graphic::Text::getContent | ( | void | ) | const |
| 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.
Definition at line 53 of file text.cpp.

| uint32_t utility::graphic::Text::getFontSize | ( | void | ) | const |
|
overridevirtual |
Get the material name.
Implements utility::graphic::Renderable.
Definition at line 89 of file text.cpp.

| 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).
|
overridevirtual |
Get the RenderableType of this object.
Implements utility::graphic::Renderable.
| 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.
Definition at line 94 of file text.cpp.

|
inlinenoexcept |
|
inline |
|
inline |
| Text & utility::graphic::Text::setContent | ( | const std::string & | content | ) |
| Text & utility::graphic::Text::setFontSize | ( | uint32_t | fontSize | ) |
|
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 117 of file text.cpp.


|
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
| str | The UTF-8 encoded string to convert. |
Definition at line 177 of file text.cpp.

|
protected |