guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
guillaume::TextRenderable Class Reference

What a render system hands to the engine to draw a piece of text: glyph quads already placed in world coordinates. More...

#include <headers/guillaume/text_renderable.hpp>

Inheritance diagram for guillaume::TextRenderable:
Collaboration diagram for guillaume::TextRenderable:

Public Member Functions

 TextRenderable (std::shared_ptr< utility::RessourceProvider > ressourceProvider, const utility::graphic::PoseF &anchor, const utility::graphic::Color32Bit &color, const std::string &content, uint32_t fontSize, const std::string &font)
 Lay out a text and place its glyphs in world coordinates.
 ~TextRenderable (void) override=default
 Default destructor.

Detailed Description

What a render system hands to the engine to draw a piece of text: glyph quads already placed in world coordinates.

systems::TextRender and systems::GlyphRender build one per entity and pass it to utility::Engine::createObject or updateObject.

utility::graphic::Text stores its glyph quads in local (object) space and relies on the renderer applying Renderable::getModelMatrix(). Every other drawable Guillaume emits (shapes, images, models) bakes world coordinates into its vertices and uses an identity pose, so a renderer that draws vertex buffers directly would leave text at the mesh origin.

This subclass keeps the Text renderable type (so the font material and the engine's text path are preserved) but rewrites the glyph vertices to world space and resets the pose to identity. Text then lands on its entity position whether or not the renderer applies the model matrix.

Note
The text is anchored by the top-left corner of the box around its glyphs, like every other entity. The renderable is a snapshot: when the pose, the content or the style of the entity changes, the system builds a new one.
See also
MeshRenderable
systems::TextRender
systems::GlyphRender

Definition at line 69 of file text_renderable.hpp.

Constructor & Destructor Documentation

◆ TextRenderable()

guillaume::TextRenderable::TextRenderable ( std::shared_ptr< utility::RessourceProvider > ressourceProvider,
const utility::graphic::PoseF & anchor,
const utility::graphic::Color32Bit & color,
const std::string & content,
uint32_t fontSize,
const std::string & font )
inline

Lay out a text and place its glyphs in world coordinates.

Parameters
ressourceProviderThe resource provider that loads the font file.
anchorThe pose of the entity: the top-left corner of the glyph box is put on its position and the text is turned by its orientation.
colorThe color of the glyphs.
contentThe characters to draw.
fontSizeThe font size, passed on to utility::graphic::Text. It is a whole number: the render systems pass components::Text::getFontSize, whose fractional part is dropped by the conversion.
fontThe path of the font file, relative to the resource root, for instance the result of theme::fontPath.

Definition at line 89 of file text_renderable.hpp.


The documentation for this class was generated from the following file: