From f0ed80cd8e0820373b6aefc0588fd235adbcfb1c Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Mon, 15 Jan 2024 14:32:48 -0700 Subject: [PATCH] Fix fallback font As this is used if you mis-spell "buffer_font_family", it should be monospace. Also treat "Zed Mono" and "Zed Sans" as valid fonts --- crates/gpui/src/text_system.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/gpui/src/text_system.rs b/crates/gpui/src/text_system.rs index 3444c05fc1..24438d8c81 100644 --- a/crates/gpui/src/text_system.rs +++ b/crates/gpui/src/text_system.rs @@ -59,14 +59,22 @@ impl TextSystem { fallback_font_stack: smallvec![ // TODO: This is currently Zed-specific. // We should allow GPUI users to provide their own fallback font stack. - font("Zed Sans"), + font("Zed Mono"), font("Helvetica") ], } } pub fn all_font_families(&self) -> Vec { - self.platform_text_system.all_font_families() + let mut families = self.platform_text_system.all_font_families(); + families.append( + &mut self + .fallback_font_stack + .iter() + .map(|font| font.family.to_string()) + .collect(), + ); + families } pub fn add_fonts(&self, fonts: &[Arc>]) -> Result<()> { self.platform_text_system.add_fonts(fonts)