fonts: restore messaging about missing glyphs

Now that all platforms know whether the system fallbacks
covered the requested glyph range, it is reasonable to
restore the configuration error window to advise the user
if they are missing fonts for the text they want to display.

refs: https://github.com/wez/wezterm/issues/671
This commit is contained in:
Wez Furlong committed 2021-04-10 21:35:58 -07:00
1 parent 22c4407ae9
commit 406d1044fa
4 files changed
+40

No files matched your search

+3
View File
@@ -1058,6 +1058,9 @@ pub struct Config {
#[serde(default = "default_stateless_process_list")]
pub skip_close_confirmation_for_processes_named: Vec<String>,
#[serde(default = "default_true")]
pub warn_about_missing_glyphs: bool,
}
impl_lua_conversion!(Config);
@@ -0,0 +1,13 @@
### warn_about_missing_glyphs = true
*Since: nightly builds only*
When set to true, if a glyph cannot be found for a given codepoint, then
the configuration error window will be shown with a pointer to the font
configuration docs.
You can set `warn_about_missing_glyphs = false` to prevent the configuration
error window from being displayed.
The default is `warn_about_missing_glyphs = true`.
+5
View File
@@ -101,6 +101,11 @@ impl FontDatabase {
let mut matches = vec![];
for parsed in self.by_full_name.values() {
if parsed.names().family.as_ref().map(|s| s.as_str())
== Some("Last Resort High-Efficiency")
{
continue;
}
let covered = parsed
.coverage_intersection(&wanted_range)
.with_context(|| format!("coverage_interaction for {:?}", parsed))?;
+19
View File
@@ -209,6 +209,7 @@ impl FontConfigInner {
let built_in = Arc::clone(&*self.built_in.borrow());
let locator = Arc::clone(&self.locator);
let pending = Arc::clone(pending);
let config = self.config.borrow().clone();
std::thread::spawn(move || {
let fallback_str = no_glyphs.iter().collect::<String>();
let mut extra_handles = vec![];
@@ -244,6 +245,24 @@ impl FontConfigInner {
let mut pending = pending.lock().unwrap();
pending.append(&mut extra_handles);
completion();
} else {
if config.warn_about_missing_glyphs {
mux::connui::show_configuration_error_message(&format!(
"No fonts contain glyphs for these codepoints: {}.\n\
Placeholder 'Last Resort' glyphs are being displayed instead.\n\
You may wish to install additional fonts, or adjust your\n\
configuration so that it can find them.\n\
https://wezfurlong.org/wezterm/config/fonts.html\n\
has more information about configuring fonts.\n\
Set warn_about_missing_glyphs=false to suppress this message.",
fallback_str.escape_unicode()
));
} else {
log::warn!(
"No fonts contain glyphs for these codepoints: {}",
fallback_str.escape_unicode()
);
}
}
});
}