diff --git a/core-text/src/font_descriptor.rs b/core-text/src/font_descriptor.rs index 9ae9680..e396e3b 100644 --- a/core-text/src/font_descriptor.rs +++ b/core-text/src/font_descriptor.rs @@ -20,6 +20,7 @@ use core_graphics::base::CGFloat; use libc::c_void; use std::mem; +use std::path::PathBuf; /* * CTFontTraits.h @@ -240,7 +241,7 @@ impl CTFontDescriptor { } } - pub fn font_path(&self) -> Option { + pub fn font_path(&self) -> Option { unsafe { let value = CTFontDescriptorCopyAttribute(self.0, kCTFontURLAttribute); if value.is_null() { @@ -250,11 +251,7 @@ impl CTFontDescriptor { let value = CFType::wrap_under_create_rule(value); assert!(value.instance_of::()); let url = CFURL::wrap_under_get_rule(mem::transmute(value.as_CFTypeRef())); - let path = CFString::wrap_under_create_rule(CFURLCopyFileSystemPath( - url.as_concrete_TypeRef(), - kCFURLPOSIXPathStyle, - )).to_string(); - Some(path) + url.to_path() } }