32#include "include/core/SkFont.h"
33#include "include/core/SkFontTypes.h"
34#include "include/core/SkRefCnt.h"
137constexpr std::optional<SkFont::Edging> sk_edging_for(
AntiAliasMode mode)
noexcept {
147constexpr std::optional<SkFontHinting> sk_hinting_for(
HintingMode mode)
noexcept {
218 sk_sp<SkTypeface> typeface;
226 std::vector<FallbackTraceStep>
trace;
242 return static_cast<bool>(typeface);
257 std::optional<SkFont::Edging> sk_edging() const noexcept {
264 std::optional<SkFontHinting> sk_hinting() const noexcept {
316 std::uint32_t codepoint);
346 FontResolver(const FontResolver&) = delete;
347 FontResolver& operator=(const FontResolver&) = delete;
349 std::unique_ptr<Impl> impl_;
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...
ResolvedFont resolve_character_fallback(const FontOptions &options, const ResolvedFont &primary, std::uint32_t codepoint)
Character-level fallback.
std::size_t cache_capacity() const noexcept
ResolvedFont resolve_family_list(const FontOptions &options)
Resolve the primary face for a FontOptions blob.
std::size_t cache_size() const noexcept
Current number of cached entries.
void clear_cache()
Test-only: discard the internal cache.
static FontResolver & instance()
Process-wide singleton. Thread-safe.
Definition affine_transform.hpp:24
std::string platform_family_for_css_family(std::string_view entry)
The family name to ask a font matcher for, for one list entry (quotes allowed): the platform family a...
bool platform_face_is_family(std::string_view platform_family, std::string_view actual_family)
Whether a face that reports actual_family is the family a matcher was asked for as platform_family,...
FontSlant
CSS-style slant.
Definition font_options.hpp:37
@ Normal
Definition font_options.hpp:38
std::string resolved_face_identity(const std::string &css_font_family, float weight, FontSlant slant=FontSlant::Normal)
The output of a resolver call.
std::vector< std::string > split_css_font_family_list(std::string_view list)
Split a font-family list on commas into trimmed entries, each KEPT with its quotes,...
ColorFontMode
Color-font policy.
Definition font_options.hpp:95
@ Auto
Definition font_options.hpp:96
std::string platform_family_for_css_generic(const std::string &css_family)
The platform family a CSS generic family keyword stands for, matching the browser's defaults on this ...
bool paragraph_fakes_missing_font_styles(std::string_view css_font_family, int weight, int slant)
Whether SkParagraph may fake the bold or oblique the matched face lacks, for text in css_font_family ...
const char * to_string(FallbackOrigin) noexcept
void set_css_generic_family_override(const std::string &keyword, const std::string &family)
Map the generic keyword to family instead of the platform default, or restore the built-in mapping wh...
FallbackOrigin
Which step of the cascade produced the resolved typeface.
Definition font_resolver.hpp:164
@ NotFound
Nothing matched and synthesis was disabled.
Definition font_resolver.hpp:174
@ Platform
Resolved by SkFontMgr::matchFamilyStyle.
Definition font_resolver.hpp:169
@ ScopePlugin
Resolved inside a Plugin-scoped registration.
Definition font_resolver.hpp:166
@ Bundled
Resolved by match_bundled_typeface (external/fonts).
Definition font_resolver.hpp:168
@ PlatformChar
Resolved by SkFontMgr::matchFamilyStyleCharacter (character-fallback path; only emitted by resolve_ch...
Definition font_resolver.hpp:170
@ ScopeView
Resolved inside a View-scoped registration.
Definition font_resolver.hpp:165
@ ScopeGlobal
Resolved inside the Global scope.
Definition font_resolver.hpp:167
@ Synthetic
No matching face; resolver applied faux-synthesis.
Definition font_resolver.hpp:173
CssFontFamily parse_css_font_family(std::string_view entry)
Parse one font-family list entry: trim whitespace, then strip one matching pair of single or double q...
HintingMode
CSS font-smoothing analogue.
Definition font_options.hpp:72
@ None
Definition font_options.hpp:73
@ PlatformDefault
Definition font_options.hpp:77
@ Slight
Definition font_options.hpp:74
@ Normal
Definition font_options.hpp:75
@ Full
Definition font_options.hpp:76
AntiAliasMode
Default follows the existing inside_non_opaque_layer() heuristic for opacity-layer text edging.
Definition font_options.hpp:84
@ NoAA
Definition font_options.hpp:88
@ Default
Definition font_options.hpp:85
@ Grayscale
Definition font_options.hpp:87
@ LCD
Definition font_options.hpp:86
One entry of a CSS font-family list, as written.
Definition font_resolver.hpp:59
std::string name
without surrounding whitespace or quotes
Definition font_resolver.hpp:60
bool quoted
written as a string: a family literally named name, never a generic keyword
Definition font_resolver.hpp:61
Definition font_resolver.hpp:179
bool succeeded
Whether this step produced a usable face.
Definition font_resolver.hpp:182
FallbackOrigin origin
Cascade step attempted at this position.
Definition font_resolver.hpp:181
std::string selected_family
Actual family name on the chosen face.
Definition font_resolver.hpp:183
std::string requested_family
Family name as listed in the cascade.
Definition font_resolver.hpp:180
std::string note
Free-text annotation (e.g. "platform default fallback rejected").
Definition font_resolver.hpp:184
The typed, hashable contract that replaces (family_string, size) throughout the font subsystem.
Definition font_options.hpp:190
Opaque identifier for a FontScope (defined in font_scope.hpp).
Definition font_options.hpp:168
Definition font_resolver.hpp:216
bool supports_color_font() const noexcept
Does the resolved typeface carry color-glyph tables?
SynthesisTrace synthesis
Definition font_resolver.hpp:227
bool color_font_active() const noexcept
Composite of color_font_mode + supports_color_font().
HintingMode hinting_mode
Definition font_resolver.hpp:233
ColorFontMode color_font_mode
Color-font mode carried from FontOptions.
Definition font_resolver.hpp:238
bool has_typeface() const noexcept
Definition font_resolver.hpp:240
FontScopeId scope
Definition font_resolver.hpp:223
std::vector< FallbackTraceStep > trace
Definition font_resolver.hpp:226
std::string actual_family
Family name reported by the chosen face.
Definition font_resolver.hpp:221
std::uint64_t generation
merged_generation_for(options.scope) at resolve time.
Definition font_resolver.hpp:224
AntiAliasMode aa_mode
AA/hinting policy carried over from the originating FontOptions.
Definition font_resolver.hpp:232
FallbackOrigin origin
Definition font_resolver.hpp:222
bool resolved() const noexcept
Definition font_resolver.hpp:248
Definition font_resolver.hpp:187
std::string source_family
Family the synthesis was applied to.
Definition font_resolver.hpp:191
bool faux_italic
Definition font_resolver.hpp:189
bool faux_width
Definition font_resolver.hpp:190
bool faux_bold
Definition font_resolver.hpp:188