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

An icon: one glyph of the Material Symbols font, chosen by name, at a given size. More...

#include <headers/guillaume/components/glyph.hpp>

Inheritance diagram for guillaume::components::Glyph:
Collaboration diagram for guillaume::components::Glyph:

Public Types

enum class  Style { Outlined , Rounded , Sharp }
 Family of the Material Symbols font the icon belongs to. More...

Public Member Functions

 Glyph (void)=default
 Default constructor for the Glyph component.
 ~Glyph (void)=default
 Default destructor for the Glyph component.
uint32_t getCode (void) const
 Get the stored code point.
Glyph & setCode (uint32_t code)
 Store a code point for the glyph.
const std::string & getName (void) const
 Get the name of the icon.
Glyph & setName (const std::string &name)
 Choose the icon by name.
const float & getFontSize (void) const
 Get the size of the icon.
Glyph & setFontSize (const float &fontSize)
 Set the size of the icon.
const Style & getStyle (void) const
 Get the font family of the icon.
Glyph & setStyle (const Style &style)
 Set the font family of the icon.
Public Member Functions inherited from guillaume::ecs::Component
bool hasChanged (void) const
 Tell whether a value of the component changed since the flags were last reset (the end of the previous frame).
void setHasChanged (bool hasChanged)
 Raise or lower the changed flag.
 Component (void)=default
 Create a component that is not marked as changed.
virtual ~Component (void)=default
 Virtual destructor, so components can be destroyed through the base class.

Detailed Description

An icon: one glyph of the Material Symbols font, chosen by name, at a given size.

entities::Icon writes it, and the widget systems resize the icons of their widgets. systems::MeasureGlyph (Measure phase) looks the name up in the font's code point table and writes the size of the glyph into the entity's components::Bound; systems::GlyphRender (Render phase) draws it at the entity's components::Transform in the entity's components::Color.

registry.getComponent<components::Glyph>(id)
.setName("settings")
.setFontSize(24.0f);
An icon: one glyph of the Material Symbols font, chosen by name, at a given size.
Definition glyph.hpp:61
Glyph & setName(const std::string &name)
Choose the icon by name.
Definition glyph.cpp:47
Glyph & setFontSize(const float &fontSize)
Set the size of the icon.
Definition glyph.cpp:62
Note
The name is what selects the drawn glyph. A name missing from the table is drawn as ?.
The systems of the library always draw with the Outlined font: the style is stored (and is part of the measure cache key) but does not change the drawing, and the code is not read to choose the glyph.
See also
systems::MeasureGlyph, systems::GlyphRender, entities::Icon

Definition at line 60 of file glyph.hpp.

Member Enumeration Documentation

◆ Style

Family of the Material Symbols font the icon belongs to.

Definition at line 66 of file glyph.hpp.

Member Function Documentation

◆ getCode()

uint32_t guillaume::components::Glyph::getCode ( void ) const

Get the stored code point.

Returns
The Unicode code point given to setCode(); 0 by default.

Definition at line 27 of file glyph.cpp.

◆ getFontSize()

const float & guillaume::components::Glyph::getFontSize ( void ) const

Get the size of the icon.

Returns
The font size, in dp; 0 by default.

Definition at line 57 of file glyph.cpp.

◆ getName()

const std::string & guillaume::components::Glyph::getName ( void ) const

Get the name of the icon.

Returns
The Material Symbols name; empty by default.

Definition at line 42 of file glyph.cpp.

◆ getStyle()

const Glyph::Style & guillaume::components::Glyph::getStyle ( void ) const

Get the font family of the icon.

Returns
The style (Outlined by default).

Definition at line 72 of file glyph.cpp.

◆ setCode()

Glyph & guillaume::components::Glyph::setCode ( uint32_t code)

Store a code point for the glyph.

The render systems resolve the glyph from its name, not from this value. Marks the component changed only when the value differs.

Parameters
codeThe Unicode code point.
Returns
This component, for chaining.

Definition at line 32 of file glyph.cpp.

Here is the call graph for this function:

◆ setFontSize()

Glyph & guillaume::components::Glyph::setFontSize ( const float & fontSize)

Set the size of the icon.

Marks the component changed only when the size differs.

Parameters
fontSizeThe font size, in dp (24 for a standard icon).
Returns
This component, for chaining.

Definition at line 62 of file glyph.cpp.

Here is the call graph for this function:

◆ setName()

Glyph & guillaume::components::Glyph::setName ( const std::string & name)

Choose the icon by name.

Marks the component changed only when the name differs.

Parameters
nameThe Material Symbols name, such as "home" or "arrow_back".
Returns
This component, for chaining.

Definition at line 47 of file glyph.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setStyle()

Glyph & guillaume::components::Glyph::setStyle ( const Style & style)

Set the font family of the icon.

Marks the component changed only when the style differs.

Parameters
styleThe style; see the class note on what the systems do with it.
Returns
This component, for chaining.

Definition at line 77 of file glyph.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

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