From a322c3e8d2d9ce18fd544c24a0a5bfa4fddf8dc6 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 30 Dec 2021 18:28:49 -0700 Subject: [PATCH] fonts: title fonts now fall back to main font list --- wezterm-font/src/lib.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/wezterm-font/src/lib.rs b/wezterm-font/src/lib.rs index 058973426..384026627 100644 --- a/wezterm-font/src/lib.rs +++ b/wezterm-font/src/lib.rs @@ -478,7 +478,7 @@ impl FontConfigInner { } } - fn last_ditch_title_font() -> (TextStyle, f64) { + fn compute_title_font(&self, config: &ConfigHandle) -> (TextStyle, f64) { fn bold(family: &str) -> FontAttributes { FontAttributes { family: family.to_string(), @@ -487,7 +487,16 @@ impl FontConfigInner { } } - let fonts = vec![bold("Roboto")]; + let mut fonts = vec![bold("Roboto")]; + // Fallback to their main font selection, so that we can pick up + // any fallback fonts they might have configured in the main + // config and so that they don't have to replicate that list for + // the title font. + for font in &config.font.font { + let mut font = font.clone(); + font.is_fallback = true; + fonts.push(font); + } let font_size = if cfg!(windows) { 10. } else { 12. }; @@ -509,7 +518,7 @@ impl FontConfigInner { return Ok(Rc::clone(entry)); } - let (sys_font, sys_size) = Self::last_ditch_title_font(); + let (sys_font, sys_size) = self.compute_title_font(&config); let mut handles = vec![];