Add forbidden font families
This commit is contained in:
parent
ce835d7014
commit
9519696a5b
5 changed files with 24 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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] {
|
||||
&[]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue