From e23ab4723995e6feb998194849a5bbe59cb2f65c Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 27 Jan 2024 23:28:20 -0700 Subject: [PATCH] macos: ignore LastResort font in fallback suggestions refs: https://github.com/wez/wezterm/issues/4877 --- docs/changelog.md | 4 ++++ wezterm-font/src/locator/core_text.rs | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index 51def0df8..a5975ed52 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -23,6 +23,10 @@ As features stabilize some brief notes about them will accumulate here. #### Changed * Not yet! +#### New +#### Fixed +* macOS: System LastResort font would be taken in preference to other fonts + in some cases when trying to find the fallback for bold fonts. #4877 ### 20240127-113634-bbcac864 diff --git a/wezterm-font/src/locator/core_text.rs b/wezterm-font/src/locator/core_text.rs index 663f2d268..09e14c5d7 100644 --- a/wezterm-font/src/locator/core_text.rs +++ b/wezterm-font/src/locator/core_text.rs @@ -146,6 +146,14 @@ impl FontLocator for CoreTextFontLocator { let candidates = handles_from_descriptor(&font.copy_descriptor()); for font in candidates { + if font.names().family == ".LastResort" + || font.names().postscript_name.as_deref() == Some("LastResort") + { + // Always exclude a last resort font, as it has + // placeholder glyphs for everything + continue; + } + if let Ok(cov) = font.coverage_intersection(&wanted) { if !cov.is_empty() { matches.push((cov.len(), font));