Fonts a document lends to a document it references with an external <use>, for one occurrence of that <use>. More...
#include "donner/svg/resources/FontManager.h"
Static Public Member Functions | |
| static std::shared_ptr< const HostFontOverlay > | Make (std::span< const css::FontFace > faces, const FontManager *hostFonts) |
| Build the overlay a host lends. | |
Public Attributes | |
| std::vector< css::FontFace > | faces |
| The host's @font-face rules, each reduced to its data sources, in declaration order, after any faces the host was itself lent. At most kMaximumLentFaces. | |
| std::vector< std::string > | faceKeys |
| css::FontFaceIdentityKey of each of faces, in the same order. | |
| std::vector< std::pair< std::string, std::string > > | genericFamilies |
| The host's CSS generic family mappings, as (lowercased generic name, family) pairs sorted by generic name. | |
| uint64_t | digest = 0 |
| Digest of faces and genericFamilies; never zero. Overlays with equal content have equal digests, since face identity follows css::FontFaceIdentityKey. | |
Fonts a document lends to a document it references with an external <use>, for one occurrence of that <use>.
The referenced element renders as an instance of the <use>, so its text resolves families the host declares, as it would if the element were in the host. The overlay holds only data sources: sources the host already turned into bytes. Lending fonts therefore fetches nothing on the referenced document's behalf, and a face whose bytes the host has not loaded is not lent. An overlay is immutable once built, so one overlay can be lent to many occurrences.
|
static |
Build the overlay a host lends.
Its cost is linear in the host's faces and mappings, so callers build it once per host and frame rather than once per occurrence.
| faces | The host's @font-face rules. |
| hostFonts | The host's font manager, for its generic family mappings and any overlay the host is itself lent. May be nullptr. |