Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

gpui_macos: Handle non-number font smoothing defaults (#56398)

Ben Brandtaa16a3bf9d57
diff --git a/crates/gpui_macos/src/text_system.rs b/crates/gpui_macos/src/text_system.rs
index 80145f706ee..2808e535ad5 100644
--- a/crates/gpui_macos/src/text_system.rs
+++ b/crates/gpui_macos/src/text_system.rs
@@ -4,7 +4,7 @@ use collections::HashMap;
use core_foundation::{
array::{CFArray, CFArrayRef},
attributed_string::CFMutableAttributedString,
- base::{CFRange, TCFType},
+ base::{CFRange, CFType, TCFType},
number::CFNumber,
string::CFString,
};
@@ -243,7 +243,10 @@ fn font_smoothing_allowed_by_user() -> bool {
if value_ref.is_null() {
return true;
}
- let number = unsafe { CFNumber::wrap_under_create_rule(value_ref as _) };
+ let value = unsafe { CFType::wrap_under_create_rule(value_ref) };
+ let Some(number) = value.downcast_into::<CFNumber>() else {
+ return true;
+ };
// Only an explicit value of `0` means that font smoothing is disabled.
number.to_i64() != Some(0)
})