pub struct FcFallbackConfig {
pub generic_families: BTreeMap<GenericFamily, Vec<String>>,
pub substitutions: BTreeMap<String, Vec<String>>,
pub script_fallbacks: Vec<FcScriptFallback>,
pub last_resort: Vec<String>,
pub default_generic: GenericFamily,
}Expand description
Fallback configuration for font resolution.
Fields§
§generic_families: BTreeMap<GenericFamily, Vec<String>>Base candidates per generic family, best first.
substitutions: BTreeMap<String, Vec<String>>Substitutions for named families that are not installed.
script_fallbacks: Vec<FcScriptFallback>Per-script preferences, in priority order.
last_resort: Vec<String>Last resort families used when no other font provides coverage.
default_generic: GenericFamilyDefault generic family when a stack doesn’t specify one.
Implementations§
Source§impl FcFallbackConfig
impl FcFallbackConfig
Sourcepub fn os_defaults(os: OperatingSystem) -> Self
pub fn os_defaults(os: OperatingSystem) -> Self
Returns the default OS-specific fallback configuration.
Sourcepub fn generic_candidates(&self, generic: GenericFamily) -> &[String]
pub fn generic_candidates(&self, generic: GenericFamily) -> &[String]
Base candidates for generic, borrowing from its
parent when it has no entry of its own.
Sourcepub fn substitutions_for(&self, family: &str) -> &[String]
pub fn substitutions_for(&self, family: &str) -> &[String]
Substitutions for the named family (normalized lookup).
Sourcepub fn script_candidates(
&self,
generic: Option<GenericFamily>,
block: &UnicodeRange,
) -> Vec<String>
pub fn script_candidates( &self, generic: Option<GenericFamily>, block: &UnicodeRange, ) -> Vec<String>
Returns the preferred fallback families for a given unicode range. Checks the specified generic family first (if any), followed by generic-agnostic fallbacks. Results are deduplicated and keep their order.
Sourcepub fn expand_generic(
&self,
generic: GenericFamily,
ranges: &[UnicodeRange],
) -> Vec<String>
pub fn expand_generic( &self, generic: GenericFamily, ranges: &[UnicodeRange], ) -> Vec<String>
Every family name a generic may resolve to for text in ranges:
script preferences for the overlapping blocks first, then the base
candidates.
Sourcepub fn expand_family(
&self,
family: &str,
ranges: &[UnicodeRange],
) -> Vec<String>
pub fn expand_family( &self, family: &str, ranges: &[UnicodeRange], ) -> Vec<String>
expand_generic for a generic keyword; a
named family expands to itself followed by its substitutions.
Sourcepub fn candidate_families(
&self,
stack: &[String],
ranges: &[UnicodeRange],
) -> Vec<String>
pub fn candidate_families( &self, stack: &[String], ranges: &[UnicodeRange], ) -> Vec<String>
Expands a CSS font stack and unicode ranges into a complete, ordered list of candidate font families to search for.
Sourcepub fn merge_defaults(&mut self, defaults: &FcFallbackConfig)
pub fn merge_defaults(&mut self, defaults: &FcFallbackConfig)
Merges missing configuration values from defaults into this config.
Does not overwrite or reorder existing entries.
Sourcepub fn extract_all_families(&self) -> Vec<String>
pub fn extract_all_families(&self) -> Vec<String>
Take over parsed platform aliases (fonts.conf <alias><prefer>):
a generic keyword becomes that generic’s base candidates, anything
else a named-family substitution. Keys are normalized family names.
Extract all unique font families listed in this fallback configuration.
pub fn absorb_system_aliases(&mut self, aliases: BTreeMap<String, Vec<String>>)
Trait Implementations§
Source§impl Clone for FcFallbackConfig
impl Clone for FcFallbackConfig
Source§fn clone(&self) -> FcFallbackConfig
fn clone(&self) -> FcFallbackConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more