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

The text styles of a theme: one TypeToken per TypeRole. More...

#include <headers/guillaume/theme/typescale.hpp>

Public Member Functions

 Typescale (void)
 Create the scale with the Material 3 baseline styles listed in TypeRole.
 ~Typescale (void)=default
 Default destructor.
const TypeToken & get (TypeRole role) const
 Get the text style of a role.
void set (TypeRole role, const TypeToken &token)
 Replace the text style of a role.

Detailed Description

The text styles of a theme: one TypeToken per TypeRole.

Read a style through guillaume::getTypeToken. To change one, edit a copy of the theme and activate it:

title.fontSize = 24.0f;
title.lineHeight = 30.0f;
Every design token of the UI in one object: colors, type scale, corner shapes, elevation,...
Definition theme.hpp:535
const theme::Typescale & getTypescale(void) const
Get the text styles of the theme.
void set(TypeRole role, const TypeToken &token)
Replace the text style of a role.
Definition typescale.cpp:89
const TypeToken & get(TypeRole role) const
Get the text style of a role.
Definition typescale.cpp:84
@ TitleLarge
22 / 28, regular.
Definition typescale.hpp:54
const Theme & getActiveTheme(void)
Get the theme every widget and system reads its tokens from.
void setActiveTheme(const Theme &theme)
Replace the active theme by a copy of another theme.
float fontSize
Font size, in dp.
Definition typescale.hpp:86
See also
guillaume::Theme::getTypescale

Definition at line 120 of file typescale.hpp.

Constructor & Destructor Documentation

◆ Typescale()

guillaume::theme::Typescale::Typescale ( void )

Create the scale with the Material 3 baseline styles listed in TypeRole.

Definition at line 59 of file typescale.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ get()

const TypeToken & guillaume::theme::Typescale::get ( TypeRole role) const

Get the text style of a role.

Parameters
roleThe typescale role to look up.
Returns
The token of that role, read-only.
Exceptions
std::out_of_rangeWhen role is TypeRole::Count.

Definition at line 84 of file typescale.cpp.

◆ set()

void guillaume::theme::Typescale::set ( TypeRole role,
const TypeToken & token )

Replace the text style of a role.

Parameters
roleThe typescale role to change.
tokenThe new style. Its font size and line height must be greater than 0.
Exceptions
std::out_of_rangeWhen role is TypeRole::Count.
std::invalid_argumentWhen the font size or the line height is zero or negative. The role keeps its previous style.

Definition at line 89 of file typescale.cpp.

Here is the caller graph for this function:

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