diff --git a/Cargo.lock b/Cargo.lock index 029dc3a2..f1ac3b3a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -253,6 +253,15 @@ dependencies = [ "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "core-foundation" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "core-foundation-sys" version = "0.4.6" @@ -261,6 +270,14 @@ dependencies = [ "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "core-foundation-sys" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "core-graphics" version = "0.12.4" @@ -273,12 +290,23 @@ dependencies = [ ] [[package]] -name = "core-text" -version = "8.0.0" +name = "core-graphics" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "core-foundation 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "core-graphics 0.12.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-text" +version = "9.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -369,10 +397,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "font" version = "0.1.0" dependencies = [ - "core-foundation 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "core-foundation-sys 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "core-graphics 0.12.4 (registry+https://github.com/rust-lang/crates.io-index)", - "core-text 8.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-text 9.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.16.4 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "freetype-rs 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1460,9 +1488,12 @@ dependencies = [ "checksum cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "56d741ea7a69e577f6d06b36b7dff4738f680593dc27a701ffa8506b73ce28bb" "checksum cocoa 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac0d785ff4faf0ff23d7b5561346bb50dc7ef9a11cb0e65e07ef776b7752938f" "checksum core-foundation 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8047f547cd6856d45b1cdd75ef8d2f21f3d0e4bf1dab0a0041b0ae9a5dda9c0e" +"checksum core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "286e0b41c3a20da26536c6000a280585d519fd07b3956b43aed8a79e9edce980" "checksum core-foundation-sys 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "152195421a2e6497a8179195672e9d4ee8e45ed8c465b626f1606d27a08ebcd5" +"checksum core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "716c271e8613ace48344f723b60b900a93150271e5be206212d052bbc0883efa" "checksum core-graphics 0.12.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8de78908c558a9ba526877d165635c9eaed0818a785a93efddde1c5bfd2ce5d1" -"checksum core-text 8.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bcad23756dd1dc4b47bf6a914ace27aadb8fa68889db5837af2308d018d0467c" +"checksum core-graphics 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb0ed45fdc32f9ab426238fba9407dfead7bacd7900c9b4dd3f396f46eafdae3" +"checksum core-text 9.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f416f900f459e0b47c86dc43a8447d16a8502904a9a9709f6037d18f3aca9ad6" "checksum dlib 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "95518d8f88d556e62c9b3014629f21bdad97a9fdfee85c68a185e3980af29e7c" "checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab" "checksum dwmapi-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b44b6442aeab12e609aee505bd1066bdfd36b79c3fe5aad604aae91537623e76" diff --git a/font/Cargo.toml b/font/Cargo.toml index 5b86ff1a..d6bc5d63 100644 --- a/font/Cargo.toml +++ b/font/Cargo.toml @@ -16,7 +16,7 @@ servo-fontconfig = { git = "https://github.com/jwilm/rust-fontconfig", branch = freetype-rs = "0.13" [target.'cfg(target_os = "macos")'.dependencies] -core-foundation = "0.4" -core-text = "8" -core-graphics = "0.12" -core-foundation-sys = "0.4" +core-foundation = "0.5" +core-text = "9.1" +core-graphics = "0.13" +core-foundation-sys = "0.5" diff --git a/font/src/darwin/mod.rs b/font/src/darwin/mod.rs index 7dde899a..feadd3f4 100644 --- a/font/src/darwin/mod.rs +++ b/font/src/darwin/mod.rs @@ -21,8 +21,7 @@ use std::ptr; use ::{Slant, Weight, Style}; -use core_foundation::base::TCFType; -use core_foundation::string::{CFString, CFStringRef}; +use core_foundation::string::{CFString}; use core_foundation::array::{CFIndex, CFArray}; use core_graphics::base::kCGImageAlphaPremultipliedFirst; use core_graphics::color_space::CGColorSpace; @@ -35,7 +34,7 @@ use core_text::font_collection::get_family_names as ct_get_family_names; use core_text::font_descriptor::kCTFontDefaultOrientation; use core_text::font_descriptor::kCTFontHorizontalOrientation; use core_text::font_descriptor::kCTFontVerticalOrientation; -use core_text::font_descriptor::{CTFontDescriptor, CTFontDescriptorRef, CTFontOrientation}; +use core_text::font_descriptor::{CTFontDescriptor, CTFontOrientation}; use core_text::font_descriptor::SymbolicTraitAccessors; use euclid::{Point2D, Rect, Size2D}; @@ -292,8 +291,7 @@ pub fn get_family_names() -> Vec { let mut owned_names = Vec::new(); for name in names.iter() { - let family: CFString = unsafe { TCFType::wrap_under_get_rule(name as CFStringRef) }; - owned_names.push(format!("{}", family)); + owned_names.push(name.to_string()); } owned_names @@ -315,16 +313,11 @@ fn cascade_list_for_languages( }; // CFArray of CTFontDescriptorRef (again) - let list = ct_cascade_list_for_languages(ct_font, &langarr.as_untyped()); + let list = ct_cascade_list_for_languages(ct_font, &langarr); // convert CFArray to Vec list.into_iter() - .map(|fontdesc| { - let desc: CTFontDescriptor = unsafe { - TCFType::wrap_under_get_rule(fontdesc as CTFontDescriptorRef) - }; - Descriptor::new(desc) - }) + .map(|fontdesc| Descriptor::new(fontdesc.clone())) .collect() } @@ -341,10 +334,7 @@ pub fn descriptors_for_family(family: &str) -> Vec { // CFArray of CTFontDescriptorRef (i think) let descriptors = ct_collection.get_descriptors(); for descriptor in descriptors.iter() { - let desc: CTFontDescriptor = unsafe { - TCFType::wrap_under_get_rule(descriptor as CTFontDescriptorRef) - }; - out.push(Descriptor::new(desc)); + out.push(Descriptor::new(descriptor.clone())); } out