Donner SVG Editor & Engine
SVG-native editor and embeddable SVG2 + CSS3 engine in C++20, with GPU (WebGPU) and compact CPU renderers, built for correctness, security, and performance.
Loading...
Searching...
No Matches
donner::svg::FontCatalog Class Reference

Aggregate font catalog: the single surface the editor's font picker and FontManager resolution consume. More...

#include "donner/svg/resources/FontCatalog.h"

Inheritance diagram for donner::svg::FontCatalog:
[legend]

Public Member Functions

 FontCatalog ()
 Construct with the default providers: embedded fonts, then platform system fonts.
 FontCatalog (std::vector< std::unique_ptr< FontFamilyProvider > > providers)
 Test/advanced constructor: supply the ordered provider list explicitly (first wins on ties).
 FontCatalog (const FontCatalog &)=delete
FontCatalogoperator= (const FontCatalog &)=delete
std::vector< FontFamilyInfofamilies () const override
 All available families, Embedded group first then System group, each group sorted by name.
bool hasFamily (std::string_view family) const override
 True if any provider supplies family (case-insensitive).
std::optional< FontFamilyInfofind (std::string_view family) const
 Resolve family (case-insensitive) to its catalog entry, or std::nullopt if no provider supplies it (in which case a document naming this family renders through the Public Sans fallback).
std::vector< uint8_t > loadFamilyData (std::string_view family) const override
 Raw sfnt bytes for family from the first provider that has it (Embedded before System).
std::vector< FontFamilyInfofamiliesBySource (FontSource source) const
 Families from a single source (Embedded or System), sorted by name.
std::vector< uint8_t > loadFace (std::string_view family) const
 Alias for loadFamilyData(), named for the picker's preview use.

Detailed Description

Aggregate font catalog: the single surface the editor's font picker and FontManager resolution consume.

A default-constructed catalog contains an embedded provider (curated Google Fonts) followed by a system provider (CoreText on macOS; a no-op stub elsewhere). Providers are consulted in order, so resolution and loadFace() prefer Embedded families over System families, and families() lists the Embedded group before the System group.

The catalog implements FontFamilyProvider, so it can be installed directly on a FontManager (via setFontProvider() or SetDefaultFontProvider()).

Picker contract (Design 0013 W2 consumes this)

Member Function Documentation

◆ families()

std::vector< FontFamilyInfo > donner::svg::FontCatalog::families ( ) const
overridevirtual

All available families, Embedded group first then System group, each group sorted by name.

If the same family name appears in both groups the Embedded one wins and the System duplicate is dropped (case-insensitive).

Implements donner::svg::FontFamilyProvider.

◆ find()

std::optional< FontFamilyInfo > donner::svg::FontCatalog::find ( std::string_view family) const

Resolve family (case-insensitive) to its catalog entry, or std::nullopt if no provider supplies it (in which case a document naming this family renders through the Public Sans fallback).

The returned FontFamilyInfo::source tells the caller whether it resolved to an Embedded or System font, mirroring findFont() precedence.

◆ hasFamily()

bool donner::svg::FontCatalog::hasFamily ( std::string_view family) const
overridevirtual

True if any provider supplies family (case-insensitive).

Implements donner::svg::FontFamilyProvider.

◆ loadFamilyData()

std::vector< uint8_t > donner::svg::FontCatalog::loadFamilyData ( std::string_view family) const
overridevirtual

Raw sfnt bytes for family from the first provider that has it (Embedded before System).

Implements donner::svg::FontFamilyProvider.


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