From e398eb84064c5eac7cb8a97c276494100a37314b Mon Sep 17 00:00:00 2001 From: Lê Viết Hoàng Dũng Date: Sat, 6 Jul 2019 16:00:16 +0700 Subject: Use Menlo as fallback font on macOS This commit makes alacritty use Menlo as a fallback font on macOS if the config specified font family isn't found. --- font/src/darwin/mod.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'font/src') diff --git a/font/src/darwin/mod.rs b/font/src/darwin/mod.rs index 3a481196..cccae032 100644 --- a/font/src/darwin/mod.rs +++ b/font/src/darwin/mod.rs @@ -314,10 +314,11 @@ pub fn descriptors_for_family(family: &str) -> Vec { let mut out = Vec::new(); trace!("Family: {}", family); - let ct_collection = match create_for_family(family) { - Some(c) => c, - None => return out, - }; + let ct_collection = create_for_family(family).unwrap_or_else(|| { + // Fallback to Menlo if we can't find the config specified font family. + warn!("Unable to load specified font {}, falling back to Menlo", &family); + create_for_family("Menlo").expect("Menlo exists") + }); // CFArray of CTFontDescriptorRef (i think) let descriptors = ct_collection.get_descriptors(); -- cgit