pub trait Fallback: Send + Sync {
    // Required methods
    fn common_fallback(&self) -> &[&'static str];
    fn forbidden_fallback(&self) -> &[&'static str];
    fn script_fallback(&self, script: Script, locale: &str) -> &[&'static str];
}Expand description
The Fallback trait allows for configurable font fallback lists to be set during construction of the FontSystem.
A custom fallback list can be added via the FontSystem::new_with_locale_and_db_and_fallback constructor.
A default implementation is provided by the PlatformFallback struct, which encapsulates the target platform’s pre-configured fallback lists.
struct MyFallback;
impl Fallback for MyFallback {
    fn common_fallback(&self) -> &[&'static str] {
        &[
            "Segoe UI",
            "Segoe UI Emoji",
            "Segoe UI Symbol",
            "Segoe UI Historic",
        ]
    }
    fn forbidden_fallback(&self) -> &[&'static str] {
        &[]
    }
    fn script_fallback(&self, script: Script, locale: &str) -> &[&'static str] {
        match script {
            Script::Adlam => &["Ebrima"],
            Script::Bengali => &["Nirmala UI"],
            Script::Canadian_Aboriginal => &["Gadugi"],
            // ...
            _ => &[],
       }
    }
}
let locale = "en-US".to_string();
let db = fontdb::Database::new();
let font_system = FontSystem::new_with_locale_and_db_and_fallback(locale, db, MyFallback);Required Methods§
Sourcefn common_fallback(&self) -> &[&'static str]
 
fn common_fallback(&self) -> &[&'static str]
Fallbacks to use after any script specific fallbacks
Sourcefn forbidden_fallback(&self) -> &[&'static str]
 
fn forbidden_fallback(&self) -> &[&'static str]
Fallbacks to never use
Sourcefn script_fallback(&self, script: Script, locale: &str) -> &[&'static str]
 
fn script_fallback(&self, script: Script, locale: &str) -> &[&'static str]
Fallbacks to use per script