Skip to main content

FcFallbackConfig

Struct FcFallbackConfig 

Source
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: GenericFamily

Default generic family when a stack doesn’t specify one.

Implementations§

Source§

impl FcFallbackConfig

Source

pub fn empty() -> Self

Returns an empty fallback configuration.

Source

pub fn os_defaults(os: OperatingSystem) -> Self

Returns the default OS-specific fallback configuration.

Source

pub fn generic_candidates(&self, generic: GenericFamily) -> &[String]

Base candidates for generic, borrowing from its parent when it has no entry of its own.

Source

pub fn substitutions_for(&self, family: &str) -> &[String]

Substitutions for the named family (normalized lookup).

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn merge_defaults(&mut self, defaults: &FcFallbackConfig)

Merges missing configuration values from defaults into this config. Does not overwrite or reorder existing entries.

Source

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.

Source

pub fn absorb_system_aliases(&mut self, aliases: BTreeMap<String, Vec<String>>)

Trait Implementations§

Source§

impl Clone for FcFallbackConfig

Source§

fn clone(&self) -> FcFallbackConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FcFallbackConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FcFallbackConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for FcFallbackConfig

Source§

impl PartialEq for FcFallbackConfig

Source§

fn eq(&self, other: &FcFallbackConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FcFallbackConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.