summaryrefslogtreecommitdiffstats
path: root/font/src/darwin/mod.rs
diff options
context:
space:
mode:
authorJeff Muizelaar <jrmuizel@gmail.com>2018-01-31 12:03:24 -0500
committerJoe Wilm <jwilm@users.noreply.github.com>2018-01-31 09:03:24 -0800
commit2466f81d5e0cb56dd00231f63f2dbcef1840196a (patch)
tree76d431e0ccf86e6c930742f9c22403b07311e7b6 /font/src/darwin/mod.rs
parent53a5a96fdd49975b4eb8072380a5573d8dd62263 (diff)
Update core-text (#1061)
This cleans up a bunch of code.
Diffstat (limited to 'font/src/darwin/mod.rs')
-rw-r--r--font/src/darwin/mod.rs22
1 files changed, 6 insertions, 16 deletions
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