Class FontCollection

Class Documentation

class FontCollection

Immutable font bytes and ordered scalable Unicode faces.

CPU-only loading snapshots application files and optional installed families, then appends an embedded DejaVu Sans fallback. Missing installed families are skipped; an unreadable/unsupported explicit file fails the whole load. No provider is used.

Public Functions

std::span<const ::CE::Text::FontFaceInfo> faces() const noexcept

Declaration: [[nodiscard]]

Returns:

Borrowed ordered face metadata, empty after moving from the collection. Keep the retained collection data alive while using the view; this call performs no discovery or loading.

bool covers(char32_t scalar) const

Declaration: [[nodiscard]]

Test character-map coverage across the retained faces without a provider.

This does not select a font for a whole grapheme or shape text. A moved-from collection or failure opening a retained face can reject a valid-scalar query.

Parameters:

scalar – Unicode scalar value; surrogates/out-of-range values return false.

Returns:

Whether at least one face maps the scalar to a glyph.

Public Static Functions

static FontCollection load(const ::CE::Text::FontSelection &selection = {})

Declaration: [[nodiscard]]

Load an immutable font-byte snapshot without a provider or graphics context.

Invalid selections, explicit file failures and unsupported faces reject the load; missing installed families are skipped. Allocation failures propagate.

Parameters:

selection – Ordered application fonts and optional system-discovery policy, borrowed only for this call.

Returns:

Owned ordered faces ending in the embedded fallback, shared by copies.