Skip to content

Commit afb65b0

Browse files
authored
Auto merge of #424 - jrmuizel:sync-desc, r=emilio
Make CTFontDescriptor Send and Sync and expose attributes()
2 parents 1bcbef7 + 597a129 commit afb65b0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

core-text/src/font_descriptor.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ declare_TCFType! {
194194
impl_TCFType!(CTFontDescriptor, CTFontDescriptorRef, CTFontDescriptorGetTypeID);
195195
impl_CFTypeDescription!(CTFontDescriptor);
196196

197+
// "Font objects (CTFont, CTFontDescriptor, and associated objects) can be used
198+
// simultaneously by multiple operations, work queues, or threads."
199+
unsafe impl Send for CTFontDescriptor {}
200+
unsafe impl Sync for CTFontDescriptor {}
197201

198202
impl CTFontDescriptor {
199203
fn get_string_attribute(&self, attribute: CFStringRef) -> Option<String> {
@@ -289,6 +293,13 @@ impl CTFontDescriptor {
289293
Ok(CTFontDescriptor::wrap_under_create_rule(desc))
290294
}
291295
}
296+
297+
pub fn attributes(&self) -> CFDictionary<CFString, CFType> {
298+
unsafe {
299+
let attrs = CTFontDescriptorCopyAttributes(self.as_concrete_TypeRef());
300+
CFDictionary::wrap_under_create_rule(attrs)
301+
}
302+
}
292303
}
293304

294305
pub fn new_from_attributes(attributes: &CFDictionary<CFString, CFType>) -> CTFontDescriptor {

0 commit comments

Comments
 (0)