1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 13:52:55 +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,29 +95,34 @@ impl LoadedFont {
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
.built_in
.borrow()
.locate_fallback_for_codepoints(&no_glyphs)
{
Ok(ref mut handles) => extra_handles.append(handles),
Err(err) => log::error!(
"Error: {} while resolving fallback for {} for built-in fonts",
err,
fallback_str.escape_debug()
),
}
}
match font_config
.built_in
.borrow()
.locate_fallback_for_codepoints(&no_glyphs)
{
Ok(ref mut handles) => extra_handles.append(handles),
Err(err) => log::error!(
"Error: {} while resolving fallback for {} for built-in fonts",
err,
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() {