From 3d5df0a1674637ad89d8b33f9b3596702d9cb882 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Tue, 2 Nov 2021 16:21:20 -0400 Subject: [PATCH 1/6] Bump the required version of core-foundation-sys --- core-foundation/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-foundation/Cargo.toml b/core-foundation/Cargo.toml index fba824b..ce2e09e 100644 --- a/core-foundation/Cargo.toml +++ b/core-foundation/Cargo.toml @@ -11,7 +11,7 @@ keywords = ["macos", "framework", "objc"] [dependencies.core-foundation-sys] path = "../core-foundation-sys" -version = "0.8.0" +version = "0.8.3" [dependencies] libc = "0.2" From 46a3b04936e93aff4ec94804b3a00f0529ed7628 Mon Sep 17 00:00:00 2001 From: Nabil Elqatib Date: Thu, 18 Nov 2021 14:02:10 +0100 Subject: [PATCH 2/6] Update cocoa-foundation/src/foundation.rs Delete default implementation --- cocoa-foundation/src/foundation.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cocoa-foundation/src/foundation.rs b/cocoa-foundation/src/foundation.rs index 80d97ca..faad59e 100644 --- a/cocoa-foundation/src/foundation.rs +++ b/cocoa-foundation/src/foundation.rs @@ -229,9 +229,7 @@ pub trait NSProcessInfo: Sized { msg_send![class!(NSProcessInfo), processInfo] } - unsafe fn systemUptime(_: Self) -> NSTimeInterval { - msg_send![class!(NSProcessInfo), systemUptime] - } + unsafe fn systemUptime(_: Self) -> NSTimeInterval; unsafe fn processName(self) -> id; unsafe fn uptime(self) -> NSTimeInterval; From bcea771dae782f230774ef604dc6028b10066262 Mon Sep 17 00:00:00 2001 From: Nabil Elqatib Date: Thu, 18 Nov 2021 14:04:47 +0100 Subject: [PATCH 3/6] Update cocoa-foundation/src/foundation.rs Fix method name --- cocoa-foundation/src/foundation.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocoa-foundation/src/foundation.rs b/cocoa-foundation/src/foundation.rs index faad59e..ca19e20 100644 --- a/cocoa-foundation/src/foundation.rs +++ b/cocoa-foundation/src/foundation.rs @@ -242,7 +242,7 @@ impl NSProcessInfo for id { msg_send![self, processName] } - unsafe fn uptime(self) -> NSTimeInterval { + unsafe fn systemUptime(self) -> NSTimeInterval { msg_send![self, systemUptime] } From e07fe2713eec0008c7e3ef36b557764151af063f Mon Sep 17 00:00:00 2001 From: Nabil Elqatib Date: Thu, 18 Nov 2021 14:06:09 +0100 Subject: [PATCH 4/6] Update cocoa-foundation/src/foundation.rs --- cocoa-foundation/src/foundation.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/cocoa-foundation/src/foundation.rs b/cocoa-foundation/src/foundation.rs index ca19e20..e8f5879 100644 --- a/cocoa-foundation/src/foundation.rs +++ b/cocoa-foundation/src/foundation.rs @@ -230,9 +230,7 @@ pub trait NSProcessInfo: Sized { } unsafe fn systemUptime(_: Self) -> NSTimeInterval; - unsafe fn processName(self) -> id; - unsafe fn uptime(self) -> NSTimeInterval; unsafe fn operatingSystemVersion(self) -> NSOperatingSystemVersion; unsafe fn isOperatingSystemAtLeastVersion(self, version: NSOperatingSystemVersion) -> bool; } From 6e78ddfb8a18b2e0f88c330e1a08c7c1f8c6a71e Mon Sep 17 00:00:00 2001 From: Nabil Elqatib Date: Thu, 18 Nov 2021 14:52:36 +0100 Subject: [PATCH 5/6] Update cocoa-foundation/src/foundation.rs --- cocoa-foundation/src/foundation.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocoa-foundation/src/foundation.rs b/cocoa-foundation/src/foundation.rs index e8f5879..b9ca8b0 100644 --- a/cocoa-foundation/src/foundation.rs +++ b/cocoa-foundation/src/foundation.rs @@ -229,7 +229,7 @@ pub trait NSProcessInfo: Sized { msg_send![class!(NSProcessInfo), processInfo] } - unsafe fn systemUptime(_: Self) -> NSTimeInterval; + unsafe fn systemUptime(self) -> NSTimeInterval; unsafe fn processName(self) -> id; unsafe fn operatingSystemVersion(self) -> NSOperatingSystemVersion; unsafe fn isOperatingSystemAtLeastVersion(self, version: NSOperatingSystemVersion) -> bool; From 1ad12536ecfd583b16c24446d1222f1ad5464113 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Mon, 22 Nov 2021 19:05:30 -0500 Subject: [PATCH 6/6] Test that we can create a new CTFont from the descriptor attributes. --- core-text/src/font.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core-text/src/font.rs b/core-text/src/font.rs index ebe6d58..d710705 100644 --- a/core-text/src/font.rs +++ b/core-text/src/font.rs @@ -691,6 +691,8 @@ fn macos_version() -> (i32, i32, i32) { #[test] fn copy_system_font() { + use crate::*; + let small = unsafe { CTFont::wrap_under_create_rule( CTFontCreateUIFontForLanguage(kCTFontSystemDetailFontType, 19., std::ptr::null()) @@ -712,6 +714,12 @@ fn copy_system_font() { let ctfont = new_from_descriptor(&desc, 20.); assert_eq!(big.postscript_name(), ctfont.postscript_name()); + // check that we can construct a new version by attributes + let attr = desc.attributes(); + let desc_from_attr = font_descriptor::new_from_attributes(&attr); + let font_from_attr = new_from_descriptor(&desc_from_attr, 19.); + assert_eq!(font_from_attr.postscript_name(), small.postscript_name()); + // on newer versions of macos we can't construct by name anymore if macos_version() < (10, 13, 0) { let ui_font_by_name = new_from_name(&small.postscript_name(), 19.).unwrap();