ZenitUI
Retained-mode C++20 UI framework
Loading...
Searching...
No Matches
ZenitUI::CodepointSet Class Reference

Composable set of Unicode codepoints for static font-atlas baking. More...

#include <Utf8.hpp>

Public Member Functions

CodepointSet & addCodepoint (uint32_t cp)
 Add a single valid Unicode scalar value.
CodepointSet & addRange (uint32_t first, uint32_t last)
 Add an inclusive range [first, last], skipping UTF-16 surrogates.
CodepointSet & addFromUtf8 (std::string_view text)
 Extract and add every valid printable codepoint from a UTF-8 string.
CodepointSet & merge (const CodepointSet &other)
 Merge all codepoints from other into this set.
void clear ()
 Remove all codepoints.
bool empty () const
 true if no codepoints have been added.
std::vector< int > build () const
 Build a sorted, deduplicated codepoint vector for font loading.

Static Public Member Functions

static CodepointSet ascii ()
 Printable ASCII (U+0020..U+007E).
static CodepointSet latin1 ()
 Latin-1 Supplement (U+00A0..U+00FF: Western European accents, °, ×, ÷).
static CodepointSet latinExtendedA ()
 Latin Extended-A (U+0100..U+017F: Central/Eastern European letters, Œ, œ).
static CodepointSet typography ()
 Common European typography (– — ‘ ’ “ ” • … € ™).
static CodepointSet defaultLatin ()
 Default preset: ASCII + Latin-1 + Œ/œ + common European typography.
static CodepointSet greek ()
 Greek and Coptic (U+0370..U+03FF).
static CodepointSet cyrillic ()
 Cyrillic (U+0400..U+04FF).
static CodepointSet symbols ()
 Common UI, math, arrow, and card/game symbols (←↑→↓ ≤≥≠∞ ▲▼◀▶ ★☆ ♠♥♦♣ ✓✗).

Detailed Description

Composable set of Unicode codepoints for static font-atlas baking.

Provides common language/symbol presets (ascii, defaultLatin, latinExtendedA, greek, cyrillic, symbols) plus fluent builders (addRange, addCodepoint, addFromUtf8, merge) that produce a sorted, deduplicated std::vector<int> suitable for backends like Raylib's LoadFontEx.

Member Function Documentation

◆ addFromUtf8()

CodepointSet & ZenitUI::CodepointSet::addFromUtf8 ( std::string_view text)
inline

Extract and add every valid printable codepoint from a UTF-8 string.

Useful to include specific symbols or localized strings directly, e.g. set.addFromUtf8("★☆♥♦♠♣✓✗→←").


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