#include <font_resolver.hpp>
Public Member Functions | |
| ResolvedFont | resolve_family_list (const FontOptions &options) |
| Resolve the primary face for a FontOptions blob. | |
| ResolvedFont | resolve_character_fallback (const FontOptions &options, const ResolvedFont &primary, std::uint32_t codepoint) |
| Character-level fallback. | |
| void | clear_cache () |
| Test-only: discard the internal cache. | |
| void | set_cache_capacity (std::size_t entries) |
| Cap the resolver cache so per-frame axis-instance variation (60fps animation across wght 100→900 = 60 distinct cache keys per second per animation) doesn't grow unbounded. | |
| std::size_t | cache_capacity () const noexcept |
| std::size_t | cache_size () const noexcept |
| Current number of cached entries. | |
Static Public Member Functions | |
| static FontResolver & | instance () |
| Process-wide singleton. Thread-safe. | |
|
noexcept |
|
noexcept |
Current number of cached entries.
Test-only — production code should not rely on cache size directly.
| void pulp::canvas::FontResolver::clear_cache | ( | ) |
Test-only: discard the internal cache.
Production code never calls this — invalidation happens through scope generation bumps baked into cache keys.
|
static |
Process-wide singleton. Thread-safe.
| ResolvedFont pulp::canvas::FontResolver::resolve_character_fallback | ( | const FontOptions & | options, |
| const ResolvedFont & | primary, | ||
| std::uint32_t | codepoint ) |
Character-level fallback.
Called by the run planner when a cluster's primary face has no glyph for one of its codepoints. Tries each face in the family stack first, then SkFontMgr::matchFamilyStyleCharacter (i.e. honors the platform font manager's per-codepoint fallback heuristics in Native/Hybrid modes; refuses heuristic fallback in Deterministic mode).
| ResolvedFont pulp::canvas::FontResolver::resolve_family_list | ( | const FontOptions & | options | ) |
Resolve the primary face for a FontOptions blob.
Walks the family stack front-to-back through the scope cascade (View → Plugin → Global → Bundled → Platform). Synthesizes faux bold / italic only if options.font_synthesis allows it; otherwise emits a SynthesisTrace documenting what would have been synthesized and returns the closest-style real face.
| void pulp::canvas::FontResolver::set_cache_capacity | ( | std::size_t | entries | ) |
Cap the resolver cache so per-frame axis-instance variation (60fps animation across wght 100→900 = 60 distinct cache keys per second per animation) doesn't grow unbounded.
Default 256 entries — enough to hold a handful of animations + the static set, small enough that the LRU eviction reliably fires on real animations. Setting 0 disables the cap (back to the previous unbounded behavior). Setting a value shrinks the cache immediately if it's currently over the new cap.