diff options
author | Lê Viết Hoàng Dũng <morepositive@outlook.com> | 2019-07-06 16:00:16 +0700 |
---|---|---|
committer | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-07-06 09:00:16 +0000 |
commit | e398eb84064c5eac7cb8a97c276494100a37314b (patch) | |
tree | d3bbe78fcc129e1850c3d58088bd5db343f59d17 | |
parent | 707f4293667d4d8564ab0afc13128463c2ee7fd5 (diff) | |
download | alacritty-e398eb84064c5eac7cb8a97c276494100a37314b.tar.gz alacritty-e398eb84064c5eac7cb8a97c276494100a37314b.zip |
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.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | font/src/darwin/mod.rs | 9 |
2 files changed, 6 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b7ed41f..d1bbd428 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The window is now filled with the background color before displaying - Cells sometimes not getting cleared correctly - X11 clipboard hanging when mime type is set +- On macOS, Alacritty will now fallback to Menlo if a font specified in the config cannot be loaded ## 0.3.3 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<Descriptor> { 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(); |