1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-25 14:22:37 +03:00

fonts: tune up fallback font resolution

* Check built-in fonts before asking the system for codepoint coverage
* If one of the earlier stages resolved some fonts, skip the remaining
  stages and speculatively shape what we have.  This avoids triggering
  the system font lookup for fonts that are present in the font_dirs
  or that are built-in, such as powerline symbols.

refs: https://github.com/wez/wezterm/issues/559
This commit is contained in:
Wez Furlong 2021-03-22 15:03:50 -07:00
parent 961e4ef9f7
commit f7b0ea2eb7

View File

@ -95,18 +95,8 @@ impl LoadedFont {
fallback_str.escape_debug() fallback_str.escape_debug()
), ),
} }
match font_config
.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_debug()
),
}
if extra_handles.is_empty() {
match font_config match font_config
.built_in .built_in
.borrow() .borrow()
@ -119,6 +109,21 @@ impl LoadedFont {
fallback_str.escape_debug() fallback_str.escape_debug()
), ),
} }
}
if extra_handles.is_empty() {
match font_config
.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_debug()
),
}
}
if extra_handles.is_empty() { if extra_handles.is_empty() {
log::warn!("No fonts have glyphs for {}", fallback_str.escape_debug()); log::warn!("No fonts have glyphs for {}", fallback_str.escape_debug());