|
|
Donner SVG 0.8.0-pre
SVG editor and embeddable C++20 engine.
|
FontFamilyProvider backed by the curated Google Fonts set embedded into the build. More...
#include "donner/svg/resources/EmbeddedFontProvider.h"
Public Member Functions | |
| std::vector< FontFamilyInfo > | families () 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. | |
FontFamilyProvider backed by the curated Google Fonts set embedded into the build.
The family table is generated from third_party/google_fonts/fonts.bzl (see the DONNER_GF_ENTRY x-macro include), so it always matches the fetched-and-embedded bytes. All families report FontSource::Embedded.
Each family is a single file, so loadFamilyData ignores the requested face: ten of the twelve curated families are variable fonts whose wght axis neither text backend instances, and the other two ship only a regular face. Bold and italic therefore render upright and regular for embedded families.
|
overridevirtual |
List the families this provider can supply.
Implements donner::svg::FontFamilyProvider.
|
overridevirtual |
Returns true if family is available (case-insensitive).
Implements donner::svg::FontFamilyProvider.
|
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().
| family | Family name to load (case-insensitive). |
| request | Face within the family to prefer. |
Implements donner::svg::FontFamilyProvider.