pub struct FcFontCache { /* private fields */ }Expand description
Font cache, initialized at startup.
Implementations§
Source§impl FcFontCache
impl FcFontCache
Sourcepub fn resolve_font_chain(
&self,
font_families: &[String],
weight: FcWeight,
italic: PatternMatch,
oblique: PatternMatch,
trace: &mut Vec<TraceMsg>,
) -> FontFallbackChain
pub fn resolve_font_chain( &self, font_families: &[String], weight: FcWeight, italic: PatternMatch, oblique: PatternMatch, trace: &mut Vec<TraceMsg>, ) -> FontFallbackChain
Resolve a fallback chain for a CSS font stack with the default script set.
Sourcepub fn resolve_font_chain_with_scripts(
&self,
font_families: &[String],
weight: FcWeight,
italic: PatternMatch,
oblique: PatternMatch,
scripts_hint: Option<&[UnicodeRange]>,
_trace: &mut Vec<TraceMsg>,
) -> FontFallbackChain
pub fn resolve_font_chain_with_scripts( &self, font_families: &[String], weight: FcWeight, italic: PatternMatch, oblique: PatternMatch, scripts_hint: Option<&[UnicodeRange]>, _trace: &mut Vec<TraceMsg>, ) -> FontFallbackChain
Resolve a fallback chain, building script fallback groups for the requested unicode blocks.
Sourcepub fn compute_fallbacks(
&self,
font_id: &FontId,
_trace: &mut Vec<TraceMsg>,
) -> Vec<FontMatchNoFallback>
pub fn compute_fallbacks( &self, font_id: &FontId, _trace: &mut Vec<TraceMsg>, ) -> Vec<FontMatchNoFallback>
Finds all registered fonts covering part of font_id’s coverage, ranked by closeness.
Source§impl FcFontCache
impl FcFontCache
Sourcepub fn fallback_config(&self) -> FcFallbackConfig
pub fn fallback_config(&self) -> FcFallbackConfig
The fallback configuration this cache resolves with (a copy).
Sourcepub fn set_fallback_config(&self, config: FcFallbackConfig) -> &Self
pub fn set_fallback_config(&self, config: FcFallbackConfig) -> &Self
Replace the fallback configuration.
Sourcepub fn with_fallback_config(self, config: FcFallbackConfig) -> Self
pub fn with_fallback_config(self, config: FcFallbackConfig) -> Self
Builder-style set_fallback_config.
Sourcepub fn system_alias_prefs(&self, family: &str) -> Vec<String>
👎Deprecated since 5.0.0: read fallback_config().generic_candidates(..) / substitutions_for(..)
pub fn system_alias_prefs(&self, family: &str) -> Vec<String>
read fallback_config().generic_candidates(..) / substitutions_for(..)
The configured candidates for family: a generic keyword’s base.
Sourcepub fn expand_font_families_config_first(
&self,
families: &[String],
os: OperatingSystem,
unicode_ranges: &[UnicodeRange],
) -> Vec<String>
👎Deprecated since 5.0.0: use fallback_config().candidate_families(families, ranges)
pub fn expand_font_families_config_first( &self, families: &[String], os: OperatingSystem, unicode_ranges: &[UnicodeRange], ) -> Vec<String>
use fallback_config().candidate_families(families, ranges)
Expand a CSS stack through this cache’s configuration, filling gaps.
Sourcepub fn with_memory_fonts(&self, fonts: Vec<(FcPattern, FcFont)>) -> &Self
pub fn with_memory_fonts(&self, fonts: Vec<(FcPattern, FcFont)>) -> &Self
Adds in-memory font files.
Sourcepub fn with_memory_font_with_id(
&self,
id: FontId,
pattern: FcPattern,
font: FcFont,
) -> &Self
pub fn with_memory_font_with_id( &self, id: FontId, pattern: FcPattern, font: FcFont, ) -> &Self
Adds a memory font with a specific ID (for testing).
Sourcepub fn insert_builder_font(&self, pattern: FcPattern, path: FcFontPath)
pub fn insert_builder_font(&self, pattern: FcPattern, path: FcFontPath)
Register a newly-parsed on-disk font.
Sourcepub fn insert_fast_pattern(
&self,
pattern: FcPattern,
path: FcFontPath,
) -> FontId
pub fn insert_fast_pattern( &self, pattern: FcPattern, path: FcFontPath, ) -> FontId
Insert a fast-probed pattern into the cache and return its.
Sourcepub fn lookup_paths_cached(&self, path: &str) -> Option<Vec<FontId>>
pub fn lookup_paths_cached(&self, path: &str) -> Option<Vec<FontId>>
Every FontId registered from the file at path (one per face and.
Sourcepub fn get_font_by_id(&self, id: &FontId) -> Option<OwnedFontSource>
pub fn get_font_by_id(&self, id: &FontId) -> Option<OwnedFontSource>
Get font data for a given font ID.
Sourcepub fn get_metadata_by_id(&self, id: &FontId) -> Option<FcPattern>
pub fn get_metadata_by_id(&self, id: &FontId) -> Option<FcPattern>
Get metadata for a font ID.
Sourcepub fn get_font_bytes(&self, id: &FontId) -> Option<Arc<FontBytes>>
pub fn get_font_bytes(&self, id: &FontId) -> Option<Arc<FontBytes>>
Get the font bytes for id as a shared FontBytes.
Sourcepub fn is_memory_font(&self, id: &FontId) -> bool
pub fn is_memory_font(&self, id: &FontId) -> bool
Check if a font ID is a memory font (preferred over disk fonts).
Sourcepub fn list(&self) -> Vec<(FcPattern, FontId)>
pub fn list(&self) -> Vec<(FcPattern, FontId)>
Every registered font with its pattern, in registration order.
Sourcepub fn for_each_pattern<F: FnMut(&FcPattern, &FontId)>(&self, f: F)
pub fn for_each_pattern<F: FnMut(&FcPattern, &FontId)>(&self, f: F)
Visit every registered font without cloning.
pub fn is_empty(&self) -> bool
Sourcepub fn query_with_fallback(
&self,
pattern: &FcPattern,
trace: &mut Vec<TraceMsg>,
) -> Option<FontMatch>
pub fn query_with_fallback( &self, pattern: &FcPattern, trace: &mut Vec<TraceMsg>, ) -> Option<FontMatch>
Like FcFontCache::query, but total: it returns None only when the.
Sourcepub fn query(
&self,
pattern: &FcPattern,
trace: &mut Vec<TraceMsg>,
) -> Option<FontMatch>
pub fn query( &self, pattern: &FcPattern, trace: &mut Vec<TraceMsg>, ) -> Option<FontMatch>
Queries a font from the in-memory cache, returns the first found font (early return).
Sourcepub fn get_memory_font(&self, id: &FontId) -> Option<FcFont>
pub fn get_memory_font(&self, id: &FontId) -> Option<FcFont>
Get in-memory font data (cloned out of the shared state).
pub fn query_matches_internal( k: &FcPattern, pattern: &FcPattern, trace: &mut Vec<TraceMsg>, ) -> bool
Sourcepub fn extract_font_name_tokens(name: &str) -> Vec<String>
pub fn extract_font_name_tokens(name: &str) -> Vec<String>
Extract tokens from a font name.
Sourcepub fn calculate_unicode_coverage(ranges: &[UnicodeRange]) -> u64
pub fn calculate_unicode_coverage(ranges: &[UnicodeRange]) -> u64
Total coverage of ranges in codepoints (widths summed; callers.
Sourcepub fn normalize_unicode_ranges(ranges: Vec<UnicodeRange>) -> Vec<UnicodeRange>
pub fn normalize_unicode_ranges(ranges: Vec<UnicodeRange>) -> Vec<UnicodeRange>
Coalesce ranges into a sorted, disjoint set.
Sourcepub fn calculate_unicode_compatibility(
requested: &[UnicodeRange],
available: &[UnicodeRange],
) -> i32
pub fn calculate_unicode_compatibility( requested: &[UnicodeRange], available: &[UnicodeRange], ) -> i32
Calculate how well a font’s Unicode ranges cover the requested ranges.