Skip to content

Commit f4b01d2

Browse files
authored
Auto merge of #418 - jrmuizel:copy-attrs, r=jdm
Expose CTFontDescriptorCreateCopyWithAttributes
2 parents b427c7d + f8b2abf commit f4b01d2

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
@@ -278,6 +278,17 @@ impl CTFontDescriptor {
278278
CFDictionary::wrap_under_get_rule(value.as_CFTypeRef() as CFDictionaryRef)
279279
}
280280
}
281+
282+
pub fn create_copy_with_attributes(&self, attr: CFDictionary) -> Result<CTFontDescriptor, ()> {
283+
unsafe {
284+
let desc = CTFontDescriptorCreateCopyWithAttributes(self.as_concrete_TypeRef(),
285+
attr.as_concrete_TypeRef());
286+
if desc.is_null() {
287+
return Err(());
288+
}
289+
Ok(CTFontDescriptor::wrap_under_create_rule(desc))
290+
}
291+
}
281292
}
282293

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

0 commit comments

Comments
 (0)