Aggregate font catalog: the single surface the editor's font picker and FontManager resolution consume. More...
#include "donner/svg/resources/FontCatalog.h"
Public Member Functions | |
| FontCatalog () | |
| Construct with the default providers: embedded fonts, then platform system fonts. | |
| FontCatalog (std::shared_ptr< CatalogEncodedFontStore > store) | |
| Use a session-owned deferred catalog store followed by the platform system provider. | |
| std::shared_ptr< CatalogEncodedFontStore > | encodedStore () const |
| The default bundled provider's delivery/admission store; null for an explicit custom list. | |
| FontCatalog (std::vector< std::unique_ptr< FontFamilyProvider > > providers) | |
| Test/advanced constructor: supply the ordered provider list explicitly (first wins on ties). Empty-byte fallback between legacy synchronous providers is supported. An immutable asset provider must precede synchronous claimants for the same family; it cannot be their fallback because doing so would separate its bytes from the selected metadata/admission contract. | |
| FontCatalog (const FontCatalog &)=delete | |
| FontCatalog & | operator= (const FontCatalog &)=delete |
| std::vector< FontFamilyInfo > | families () const override |
| All available families, Bundled 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< FontFamilyInfo > | 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). | |
| std::vector< uint8_t > | loadFamilyData (std::string_view family, const FontFaceRequest &request) const override |
Encoded font-file bytes for family from the first provider that has it (Bundled before System). | |
| FontFaceAvailability | availability (std::string_view family, const FontFaceRequest &request) const override |
| Metadata only; the default preserves existing synchronous/system/custom providers. | |
| FontFaceAdmission | tryAcquireFace (std::string_view family, const FontFaceRequest &request) const override |
| Acquire product-wide copy/decode admission without blocking. Does not fetch missing bytes. | |
| std::vector< FontFamilyInfo > | familiesBySource (FontSource source) const |
| Families from a single source (Bundled 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. Previews show the family's default face, so this asks for the regular upright one. | |
Aggregate font catalog: the single surface the editor's font picker and FontManager resolution consume.
The default catalog also resolves the CSS generic sans-serif family through bundled regular, bold, and italic faces without listing it as a named picker family.
A default-constructed catalog contains the generic sans-serif faces, an embedded provider (curated Google Fonts), then a system provider (CoreText on macOS; a no-op stub elsewhere). Providers are consulted in order, so resolution and loadFace() prefer Bundled families over System families, and families() lists the Bundled group before the System group.
The catalog implements FontFamilyProvider, so it can be installed directly on a FontManager (via setFontProvider() or SetDefaultFontProvider()).
|
overridevirtual |
Metadata only; the default preserves existing synchronous/system/custom providers.
Reimplemented from donner::svg::FontFamilyProvider.
|
overridevirtual |
All available families, Bundled group first then System group, each group sorted by name.
If the same family name appears in both groups the Bundled one wins and the System duplicate is dropped (case-insensitive).
Implements donner::svg::FontFamilyProvider.
| 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 Bundled or System font, mirroring findFont() precedence.
|
overridevirtual |
True if any provider supplies family (case-insensitive).
Implements donner::svg::FontFamilyProvider.
|
overridevirtual |
Encoded font-file bytes for family from the first provider that has it (Bundled before System).
Implements donner::svg::FontFamilyProvider.
|
overridevirtual |
Acquire product-wide copy/decode admission without blocking. Does not fetch missing bytes.
Reimplemented from donner::svg::FontFamilyProvider.