Skip to content

Commit b8e8216

Browse files
committed
stuff
1 parent 90b8d73 commit b8e8216

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

core-text/src/font.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -879,23 +879,24 @@ fn font_data() {
879879
#[test]
880880
fn variations() {
881881
let mut vals_str: Vec<(CFString, CFNumber)> = Vec::new();
882-
let small = unsafe {
882+
let system_font = unsafe {
883883
CTFont::wrap_under_create_rule(
884884
CTFontCreateUIFontForLanguage(kCTFontEmphasizedSystemDetailFontType, 19., std::ptr::null())
885885
)
886886
};
887-
dbg!(&small);
888-
//let font = CGFont::from_name(&CFString::new(".SFNSText-Bold")).unwrap();
889-
let font= small.copy_to_CGFont();
887+
let font = system_font.copy_to_CGFont();
890888
vals_str.push((CFString::new("Weight"), (700.).into()) );
891889
let vars = CFDictionary::from_CFType_pairs(&vals_str);
892890
let var_font = CGFont::create_copy_from_variations(&font, &vars).unwrap();
893-
extern {
894-
pub fn CFCopyDescription(obj: usize) -> usize;
895-
}
896-
let s: CFString = unsafe { std::mem::transmute(CFCopyDescription(std::mem::transmute(var_font.clone()))) };
897-
println!("{:}", s);
891+
// Check if new_from_CGFont will work on our CGFont with variations applied
898892
let ct_font = new_from_CGFont(&var_font.clone(), 19.);
899-
dbg!(ct_font.family_name());
900-
assert!(false);
893+
match macos_version() {
894+
(10, 15, 0) => assert_ne!(ct_font.family_name(), ".LastResort"),
895+
(10, 14, 0) => assert_eq!(ct_font.family_name(), ".LastResort"),
896+
(10, 13, 0) => assert_eq!(ct_font.family_name(), ".LastResort"),
897+
(10, 12, 0) => assert_eq!(ct_font.family_name(), ".LastResort"),
898+
(10, 11, 0) => assert_ne!(ct_font.family_name(), ".LastResort"),
899+
_ => assert_ne!(ct_font.family_name(), ".LastResort"),
900+
901+
}
901902
}

0 commit comments

Comments
 (0)