diff --git a/core-text/src/font_descriptor.rs b/core-text/src/font_descriptor.rs index a6995f7..c70495c 100644 --- a/core-text/src/font_descriptor.rs +++ b/core-text/src/font_descriptor.rs @@ -194,6 +194,10 @@ declare_TCFType! { impl_TCFType!(CTFontDescriptor, CTFontDescriptorRef, CTFontDescriptorGetTypeID); impl_CFTypeDescription!(CTFontDescriptor); +// "Font objects (CTFont, CTFontDescriptor, and associated objects) can be used +// simultaneously by multiple operations, work queues, or threads." +unsafe impl Send for CTFontDescriptor {} +unsafe impl Sync for CTFontDescriptor {} impl CTFontDescriptor { fn get_string_attribute(&self, attribute: CFStringRef) -> Option { @@ -289,6 +293,13 @@ impl CTFontDescriptor { Ok(CTFontDescriptor::wrap_under_create_rule(desc)) } } + + pub fn attributes(&self) -> CFDictionary { + unsafe { + let attrs = CTFontDescriptorCopyAttributes(self.as_concrete_TypeRef()); + CFDictionary::wrap_under_create_rule(attrs) + } + } } pub fn new_from_attributes(attributes: &CFDictionary) -> CTFontDescriptor {