Curated bundled fonts, sharing one generated WOFF2 catalog on native and Wasm. More...
#include "donner/svg/resources/EmbeddedFontProvider.h"
Public Member Functions | |
| EmbeddedFontProvider (std::shared_ptr< CatalogEncodedFontStore > store) | |
| Explicit deferred delivery, also usable by native applications and deterministic tests. | |
| 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. | |
| 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< uint8_t > | loadFamilyData (std::string_view family, const FontFaceRequest &request) const override |
Load encoded font-file bytes (sfnt, or WOFF2 in a full-text consumer) for the face of family that best matches request, or an empty vector if the family is unavailable. | |
| std::shared_ptr< CatalogEncodedFontStore > | encodedStore () const |
| Session-owned delivery/admission state. Native needs no copied encoded cache. | |
Curated bundled fonts, sharing one generated WOFF2 catalog on native and Wasm.
Native uses compiled compressed spans and stays self-contained. Wasm links only the manifest and obtains verified encoded bytes from the session store. Enumeration never requests bytes. Each family retains its existing single variable/static file and face-selection behavior.
|
overridevirtual |
Metadata only; the default preserves existing synchronous/system/custom providers.
Reimplemented from donner::svg::FontFamilyProvider.
|
overridevirtual |
List the families this provider can supply.
Implements donner::svg::FontFamilyProvider.
|
overridevirtual |
Returns true if family is available.
Matching must be case-insensitive: callers fold family names when they index them, so a provider that compared case-sensitively would disagree with its own caller about which families exist.
It must also answer in constant or logarithmic time. Text layout asks once per unresolved family per span, and the number of families a provider holds is set by the host rather than by the document, so a linear scan of the provider's list turns one layout into work proportional to spans times families times installed fonts. Providers that enumerate a list should build a folded index alongside it rather than scanning it per call, and must not perform I/O or re-enumerate the underlying font source here.
| family | Font family name to test. |
Implements donner::svg::FontFamilyProvider.
|
overridevirtual |
Load encoded font-file bytes (sfnt, or WOFF2 in a full-text consumer) 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() when its feature tier supports that format. They are not necessarily raw sfnt and must not be passed directly to an SFNT-only consumer such as an ImGui TTF loader.
A synchronous provider whose load cost grows with the font's size should poll ScopedFontLoadInterruption::Requested and may return an empty vector once it is true.
| family | Family name to load (case-insensitive). |
| request | Face within the family to prefer. |
Implements donner::svg::FontFamilyProvider.
|
overridevirtual |
Acquire product-wide copy/decode admission without blocking. Does not fetch missing bytes.
Reimplemented from donner::svg::FontFamilyProvider.