diff options
author | Jeff Muizelaar <jrmuizel@gmail.com> | 2018-01-31 12:03:24 -0500 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2018-01-31 09:03:24 -0800 |
commit | 2466f81d5e0cb56dd00231f63f2dbcef1840196a (patch) | |
tree | 76d431e0ccf86e6c930742f9c22403b07311e7b6 /font | |
parent | 53a5a96fdd49975b4eb8072380a5573d8dd62263 (diff) | |
download | alacritty-2466f81d5e0cb56dd00231f63f2dbcef1840196a.tar.gz alacritty-2466f81d5e0cb56dd00231f63f2dbcef1840196a.zip |
Update core-text (#1061)
This cleans up a bunch of code.
Diffstat (limited to 'font')
-rw-r--r-- | font/Cargo.toml | 8 | ||||
-rw-r--r-- | font/src/darwin/mod.rs | 22 |
2 files changed, 10 insertions, 20 deletions
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<String> { 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<Descriptor> 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<Descriptor> { // 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 |