Skip to content

ui::FontName

Header: winui/render/Text.hpp.

A font family name kept inline, so whatever holds one owns its copy: a name taken from a std::string stays valid after the string is gone. A literal, a std::string_view or a std::string converts to it, and it is usable in constexpr tables (ui::glyphs::). Up to Capacity bytes of UTF-8; a longer name asserts and is cut.

Example:

ui::IconGlyph star_icon(const std::string& family) // a family name read from the settings
{
    return ui::IconGlyph{0xE734, family}; // copies the name
}

Capacity

static std::size_t Capacity = 63

The longest name it holds, in bytes.

FontName

constexpr FontName() noexcept = default

The empty name.

FontName

constexpr FontName(const char* name) noexcept

From a NUL-terminated name; null is the empty name.

FontName

constexpr FontName(std::string_view name) noexcept

From any run of characters.

FontName

FontName(const std::string& name) noexcept

From a string, copied.

c_str

const char* c_str() const noexcept

The name, NUL-terminated.

view

std::string_view view() const noexcept

The name.

operator std::string_view

constexpr operator std::string_view() const noexcept

The name as a string_view.

empty

bool empty() const noexcept

True for the empty name.

size

std::size_t size() const noexcept

The name's length in bytes.

data

const char* data() const noexcept

The name's bytes, NUL-terminated.

str

std::string str() const

The name as a std::string.