From 406d1044fab717e867ca9dd401a041b93cd8d41c Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 10 Apr 2021 21:22:41 -0700 Subject: [PATCH] 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 --- config/src/lib.rs | 3 +++ .../lua/config/warn_about_missing_glyphs.md | 13 +++++++++++++ wezterm-font/src/db.rs | 5 +++++ wezterm-font/src/lib.rs | 19 +++++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 docs/config/lua/config/warn_about_missing_glyphs.md diff --git a/config/src/lib.rs b/config/src/lib.rs index 099a2c15b..99aef4e4d 100644 --- a/config/src/lib.rs +++ b/config/src/lib.rs @@ -1058,6 +1058,9 @@ pub struct Config { #[serde(default = "default_stateless_process_list")] pub skip_close_confirmation_for_processes_named: Vec, + + #[serde(default = "default_true")] + pub warn_about_missing_glyphs: bool, } impl_lua_conversion!(Config); diff --git a/docs/config/lua/config/warn_about_missing_glyphs.md b/docs/config/lua/config/warn_about_missing_glyphs.md new file mode 100644 index 000000000..1a18bfd1b --- /dev/null +++ b/docs/config/lua/config/warn_about_missing_glyphs.md @@ -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`. + diff --git a/wezterm-font/src/db.rs b/wezterm-font/src/db.rs index 805b45f22..afca3efed 100644 --- a/wezterm-font/src/db.rs +++ b/wezterm-font/src/db.rs @@ -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))?; diff --git a/wezterm-font/src/lib.rs b/wezterm-font/src/lib.rs index 0f1a4edde..96fe3d20a 100644 --- a/wezterm-font/src/lib.rs +++ b/wezterm-font/src/lib.rs @@ -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::(); 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() + ); + } } }); }