mirror of
https://github.com/wez/wezterm.git
synced 2024-11-10 15:04:32 +03:00
linux/freebsd: avoid random fontconfig fallbacks
This is the same class of problem as c32de40978
but on X11/Wayland systems.
In this case, the 100 or so "random" fontconfig fallbacks were
taking precedence over our locally configured emoji fallback.
This commit filters the fontconfig results to more exact matches,
with less surprising results.
This may come at the cost of magically resolving fallback fonts
for unusual scripts, however.
This commit is contained in:
parent
f2cbc182cd
commit
6cee020c89
@ -34,7 +34,7 @@ impl FontLocator for FontConfigFontLocator {
|
||||
// at index 0.
|
||||
let font_list = pattern.sort(true)?;
|
||||
|
||||
for (idx, pat) in font_list.iter().enumerate() {
|
||||
for pat in font_list.iter() {
|
||||
pattern.render_prepare(&pat)?;
|
||||
let file = pat.get_file()?;
|
||||
|
||||
@ -43,15 +43,14 @@ impl FontLocator for FontConfigFontLocator {
|
||||
index: pat.get_integer("index")?.try_into()?,
|
||||
};
|
||||
|
||||
// When it comes to handling fallback, we prefer our
|
||||
// user specified set of names so we take those first.
|
||||
// The additional items in this loop are fallback fonts
|
||||
// suggested by fontconfig and are lower precedence
|
||||
if idx == 0 {
|
||||
// fontconfig will give us a boatload of random fallbacks.
|
||||
// so we need to parse the returned font
|
||||
// here to see if we got what we asked for.
|
||||
if let Ok(parsed) = crate::font::parser::ParsedFont::from_locator(&handle) {
|
||||
if crate::font::parser::font_info_matches(attr, parsed.names()) {
|
||||
fonts.push(handle);
|
||||
loaded.insert(attr.clone());
|
||||
} else {
|
||||
fallback.push(handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user