diff --git a/examples/text/src/font/fallback/macos.rs b/examples/text/src/font/fallback/macos.rs index a4b7947b..9f9822fd 100644 --- a/examples/text/src/font/fallback/macos.rs +++ b/examples/text/src/font/fallback/macos.rs @@ -8,6 +8,11 @@ pub fn common_fallback() -> &'static [&'static str] { ] } +// Fallbacks to never use +pub fn forbidden_fallback() -> &'static [&'static str] { + &[] +} + // Fallbacks to use per script pub fn script_fallback(script: &Script, locale: &str) -> &'static [&'static str] { //TODO: abstract style (sans/serif/monospaced) diff --git a/examples/text/src/font/fallback/mod.rs b/examples/text/src/font/fallback/mod.rs index 6d2f1e94..abe3dba1 100644 --- a/examples/text/src/font/fallback/mod.rs +++ b/examples/text/src/font/fallback/mod.rs @@ -123,10 +123,13 @@ impl<'a> Iterator for FontFallbackIter<'a> { //TODO: do we need to do this? //TODO: do not evaluate fonts more than once! + let forbidden_families = forbidden_fallback(); while self.other_i < self.fonts.len() { let font = &self.fonts[self.other_i]; self.other_i += 1; - return Some(font); + if ! forbidden_families.contains(&font.info.family.as_str()) { + return Some(font); + } } self.end = true; diff --git a/examples/text/src/font/fallback/other.rs b/examples/text/src/font/fallback/other.rs index f13e8798..f569ddd7 100644 --- a/examples/text/src/font/fallback/other.rs +++ b/examples/text/src/font/fallback/other.rs @@ -5,6 +5,11 @@ pub fn common_fallback() -> &'static [&'static str] { &[] } +// Fallbacks to never use +pub fn forbidden_fallback() -> &'static [&'static str] { + &[] +} + // Fallbacks to use per script pub fn script_fallback(script: &Script, locale: &str) -> &'static [&'static str] { &[] diff --git a/examples/text/src/font/fallback/unix.rs b/examples/text/src/font/fallback/unix.rs index 03ffd034..a68b8fc8 100644 --- a/examples/text/src/font/fallback/unix.rs +++ b/examples/text/src/font/fallback/unix.rs @@ -13,6 +13,11 @@ pub fn common_fallback() -> &'static [&'static str] { ] } +// Fallbacks to never use +pub fn forbidden_fallback() -> &'static [&'static str] { + &[] +} + fn han_unification(locale: &str) -> &'static [&'static str] { match locale { // Japan diff --git a/examples/text/src/font/fallback/windows.rs b/examples/text/src/font/fallback/windows.rs index af703bcd..6a992d64 100644 --- a/examples/text/src/font/fallback/windows.rs +++ b/examples/text/src/font/fallback/windows.rs @@ -12,6 +12,11 @@ pub fn common_fallback() -> &'static [&'static str] { ] } +// Fallbacks to never use +pub fn forbidden_fallback() -> &'static [&'static str] { + &[] +} + fn han_unification(locale: &str) -> &'static [&'static str] { //TODO! match locale {