1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-10 15:04:32 +03:00

fonts: search locator for fallbacks first

Also add an option to control whether we look in font_dirs for fallback.
Previously we would, but it could lead to some surprising fallback
choices.

The default now is to search locator then built-in.

refs: https://github.com/wez/wezterm/issues/685
refs: https://github.com/wez/wezterm/issues/727
This commit is contained in:
Wez Furlong 2021-05-01 11:02:26 -07:00
parent faaf6dea30
commit 9ccdc157a7
2 changed files with 16 additions and 11 deletions

View File

@ -1095,6 +1095,9 @@ pub struct Config {
#[serde(default)]
pub sort_fallback_fonts_by_coverage: bool,
#[serde(default)]
pub search_font_dirs_for_fallback: bool,
#[serde(default)]
pub swallow_mouse_click_on_pane_focus: bool,

View File

@ -224,15 +224,26 @@ impl FontConfigInner {
fallback_str.escape_unicode()
);
match font_dirs.locate_fallback_for_codepoints(&no_glyphs) {
match locator.locate_fallback_for_codepoints(&no_glyphs) {
Ok(ref mut handles) => extra_handles.append(handles),
Err(err) => log::error!(
"Error: {:#} while resolving fallback for {} from font_dirs",
"Error: {:#} while resolving fallback for {} from font-locator",
err,
fallback_str.escape_unicode()
),
}
if config.search_font_dirs_for_fallback {
match font_dirs.locate_fallback_for_codepoints(&no_glyphs) {
Ok(ref mut handles) => extra_handles.append(handles),
Err(err) => log::error!(
"Error: {:#} while resolving fallback for {} from font_dirs",
err,
fallback_str.escape_unicode()
),
}
}
match built_in.locate_fallback_for_codepoints(&no_glyphs) {
Ok(ref mut handles) => extra_handles.append(handles),
Err(err) => log::error!(
@ -242,15 +253,6 @@ impl FontConfigInner {
),
}
match locator.locate_fallback_for_codepoints(&no_glyphs) {
Ok(ref mut handles) => extra_handles.append(handles),
Err(err) => log::error!(
"Error: {:#} while resolving fallback for {} from font-locator",
err,
fallback_str.escape_unicode()
),
}
let mut wanted = RangeSet::new();
for c in no_glyphs {
wanted.add(c as u32);