1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-22 22:42:48 +03:00

macos: constrain fallback to normal attributes

refs: https://github.com/wez/wezterm/issues/4808
This commit is contained in:
Wez Furlong 2024-01-29 20:01:48 -07:00
parent a51c6a2638
commit c4f16fe339
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
2 changed files with 13 additions and 0 deletions

View File

@ -25,6 +25,8 @@ As features stabilize some brief notes about them will accumulate here.
* Not yet! * Not yet!
#### New #### New
#### Fixed #### Fixed
* macOS: fallback fonts could select thin or otherwise unspecified font
attributes. #4808
### 20240128-202157-1e552d76 ### 20240128-202157-1e552d76

View File

@ -162,6 +162,17 @@ impl FontLocator for CoreTextFontLocator {
continue; continue;
} }
let is_normal = font.weight() == FontWeight::REGULAR
&& font.stretch() == FontStretch::Normal
&& font.style() == FontStyle::Normal;
if !is_normal {
// Only use normal attributed text for fallbacks,
// otherwise we'll end up picking something with
// undefined and undesirable attributes
// <https://github.com/wez/wezterm/issues/4808>
continue;
}
if let Ok(cov) = font.coverage_intersection(&wanted) { if let Ok(cov) = font.coverage_intersection(&wanted) {
// Explicitly check coverage because the list may not // Explicitly check coverage because the list may not
// actually match the text we asked about(!) // actually match the text we asked about(!)