|
12 | 12 | use font_descriptor::{CTFontDescriptor, CTFontDescriptorRef, CTFontOrientation};
|
13 | 13 | use font_descriptor::{CTFontSymbolicTraits, CTFontTraits, SymbolicTraitAccessors, TraitAccessors};
|
14 | 14 |
|
| 15 | +use core_foundation::array::{CFArray, CFArrayRef}; |
15 | 16 | use core_foundation::base::{CFIndex, CFOptionFlags, CFTypeID, CFRelease, CFRetain, CFTypeRef, TCFType};
|
16 | 17 | use core_foundation::data::{CFData, CFDataRef};
|
17 | 18 | use core_foundation::dictionary::CFDictionaryRef;
|
@@ -378,6 +379,15 @@ pub fn debug_font_traits(font: &CTFont) {
|
378 | 379 | // println!("kCTFontSlantTrait: {}", traits.normalized_slant());
|
379 | 380 | }
|
380 | 381 |
|
| 382 | +pub fn cascade_list_for_languages(font: &CTFont, language_pref_list: &CFArray) -> CFArray { |
| 383 | + unsafe { |
| 384 | + let font_collection_ref = |
| 385 | + CTFontCopyDefaultCascadeListForLanguages(font.as_concrete_TypeRef(), |
| 386 | + language_pref_list.as_concrete_TypeRef()); |
| 387 | + TCFType::wrap_under_create_rule(font_collection_ref) |
| 388 | + } |
| 389 | +} |
| 390 | + |
381 | 391 | #[link(name = "ApplicationServices", kind = "framework")]
|
382 | 392 | extern {
|
383 | 393 | /*
|
@@ -453,6 +463,8 @@ extern {
|
453 | 463 | fn CTFontCopyName(font: CTFontRef, nameKey: CFStringRef) -> CFStringRef;
|
454 | 464 | //fn CTFontCopyLocalizedName(font: CTFontRef, nameKey: CFStringRef,
|
455 | 465 | // language: *CFStringRef) -> CFStringRef;
|
| 466 | + fn CTFontCopyDefaultCascadeListForLanguages(font: CTFontRef, languagePrefList: CFArrayRef) -> CFArrayRef; |
| 467 | + |
456 | 468 |
|
457 | 469 | /* Working With Encoding */
|
458 | 470 | //fn CTFontCopyCharacterSet
|
|
0 commit comments