Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::svg::SystemFontProvider Class Reference

FontFamilyProvider backed by the host operating system's installed fonts. More...

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

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

Public Member Functions

std::vector< FontFamilyInfofamilies () const override
 List the families this provider can supply.
bool hasFamily (std::string_view family) const override
 Returns true if family is available (case-insensitive).
std::vector< uint8_t > loadFamilyData (std::string_view family, const FontFaceRequest &request) const override
 Load the raw sfnt (TTF/OTF) bytes for the face of family that best matches request, or an empty vector if the family is unavailable.

Static Public Member Functions

static bool isSupported ()
 Returns true if this build enumerates real system fonts (i.e. macOS), false for the stub.

Detailed Description

FontFamilyProvider backed by the host operating system's installed fonts.

On macOS this enumerates families via CoreText (CTFontManagerCopyAvailableFontFamilyNames) and materializes a flat sfnt byte stream on demand by reconstructing the font's tables through CoreText (which works even for .ttc/.dfont members). Faces within a family are scored against the requested weight/style/stretch, so bold and italic resolve to the real designed face. All families report FontSource::System.

On non-Apple platforms this is a stub: it enumerates nothing and loads nothing, so the catalog still compiles and behaves (embedded fonts only).

Member Function Documentation

◆ families()

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

List the families this provider can supply.

Implements donner::svg::FontFamilyProvider.

◆ hasFamily()

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

Returns true if family is available (case-insensitive).

Implements donner::svg::FontFamilyProvider.

◆ loadFamilyData()

std::vector< uint8_t > donner::svg::SystemFontProvider::loadFamilyData ( std::string_view family,
const FontFaceRequest & request ) const
overridevirtual

Load the raw sfnt (TTF/OTF) bytes for the face of family that best matches request, or an empty vector if the family is unavailable.

Providers that only hold a single file per family return it for every request, which means bold and italic render as regular for those families - see EmbeddedFontProvider.

The returned bytes are suitable for FontManager::loadFontData().

Parameters
familyFamily name to load (case-insensitive).
requestFace within the family to prefer.

Implements donner::svg::FontFamilyProvider.


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