objc2_core_text/generated/
CTFontCollection.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10
11use crate::*;
12
13/// [Apple's documentation](https://developer.apple.com/documentation/coretext/ctfontcollection?language=objc)
14///
15/// This is toll-free bridged with `NSFontCollection`.
16#[doc(alias = "CTFontCollectionRef")]
17#[repr(C)]
18pub struct CTFontCollection {
19    inner: [u8; 0],
20    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
21}
22
23cf_type!(
24    unsafe impl CTFontCollection {}
25);
26#[cfg(feature = "objc2")]
27cf_objc2_type!(
28    unsafe impl RefEncode<"__CTFontCollection"> for CTFontCollection {}
29);
30
31/// [Apple's documentation](https://developer.apple.com/documentation/coretext/ctmutablefontcollection?language=objc)
32///
33/// This is toll-free bridged with `NSMutableFontCollection`.
34#[doc(alias = "CTMutableFontCollectionRef")]
35#[repr(C)]
36pub struct CTMutableFontCollection {
37    inner: [u8; 0],
38    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
39}
40
41cf_type!(
42    unsafe impl CTMutableFontCollection: CTFontCollection {}
43);
44#[cfg(feature = "objc2")]
45cf_objc2_type!(
46    unsafe impl RefEncode<"__CTFontCollection"> for CTMutableFontCollection {}
47);
48
49unsafe impl ConcreteType for CTFontCollection {
50    /// Returns the type identifier for Core Text font collection references.
51    ///
52    /// Returns: The identifier for the opaque types CTFontCollectionRef or CTMutableFontCollectionRef.
53    #[doc(alias = "CTFontCollectionGetTypeID")]
54    #[inline]
55    fn type_id() -> CFTypeID {
56        extern "C-unwind" {
57            fn CTFontCollectionGetTypeID() -> CFTypeID;
58        }
59        unsafe { CTFontCollectionGetTypeID() }
60    }
61}
62
63/// Collection sorting callback.
64///
65/// This callback can be specified to obtain the matching font descriptors of a collection in sorted order. Return the appropriate comparison result of first descriptor to second descriptor.
66///
67/// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/ctfontcollectionsortdescriptorscallback?language=objc)
68#[cfg(feature = "CTFontDescriptor")]
69pub type CTFontCollectionSortDescriptorsCallback = Option<
70    unsafe extern "C-unwind" fn(
71        NonNull<CTFontDescriptor>,
72        NonNull<CTFontDescriptor>,
73        NonNull<c_void>,
74    ) -> CFComparisonResult,
75>;
76
77extern "C" {
78    /// kCTFontCollectionRemoveDuplicatesOption
79    ///
80    /// Option key to specify filtering of duplicates.
81    ///
82    /// Specify this option key in the options dictionary with a non- zero value to enable automatic filtering of duplicate font descriptors.
83    ///
84    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontcollectionremoveduplicatesoption?language=objc)
85    pub static kCTFontCollectionRemoveDuplicatesOption: &'static CFString;
86}
87
88extern "C" {
89    /// kCTFontCollectionIncludeDisabledFontsOption
90    ///
91    /// Option key to include disabled fonts in the matching results.
92    ///
93    /// Specify this option key in the options dictionary with a non-zero value to enable matching of disabled fonts. You can pass font descriptors specifying disabled fonts to CTFontManagerEnableFontDescriptors, but you cannot use such a font descriptor to query font attributes from the system database or create a CTFontRef.
94    ///
95    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontcollectionincludedisabledfontsoption?language=objc)
96    pub static kCTFontCollectionIncludeDisabledFontsOption: &'static CFString;
97}
98
99extern "C" {
100    /// kCTFontCollectionDisallowAutoActivationOption
101    ///
102    /// Option key to avoid auto-activating fonts.
103    ///
104    /// Specify this option key in the options dictionary with a non-zero value to disallow searches for missing fonts (font descriptors returning no results).
105    ///
106    /// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/kctfontcollectiondisallowautoactivationoption?language=objc)
107    pub static kCTFontCollectionDisallowAutoActivationOption: &'static CFString;
108}
109
110impl CTFontCollection {
111    /// Returns a new font collection matching all available fonts.
112    ///
113    ///
114    /// Parameter `options`: The options dictionary. See constant option keys.
115    ///
116    ///
117    /// Returns: This function creates a new collection containing all fonts available to the current application.
118    ///
119    /// # Safety
120    ///
121    /// `options` generics must be of the correct type.
122    #[doc(alias = "CTFontCollectionCreateFromAvailableFonts")]
123    #[inline]
124    pub unsafe fn from_available_fonts(
125        options: Option<&CFDictionary>,
126    ) -> CFRetained<CTFontCollection> {
127        extern "C-unwind" {
128            fn CTFontCollectionCreateFromAvailableFonts(
129                options: Option<&CFDictionary>,
130            ) -> Option<NonNull<CTFontCollection>>;
131        }
132        let ret = unsafe { CTFontCollectionCreateFromAvailableFonts(options) };
133        let ret =
134            ret.expect("function was marked as returning non-null, but actually returned NULL");
135        unsafe { CFRetained::from_raw(ret) }
136    }
137
138    /// Returns a new collection based on the array of font descriptors.
139    ///
140    ///
141    /// Parameter `queryDescriptors`: An array of font descriptors to use for matching. May be NULL, in which case the matching descriptors will be NULL.
142    ///
143    ///
144    /// Parameter `options`: The options dictionary. See constant option keys.
145    ///
146    ///
147    /// Returns: This function creates a new collection based on the provided font descriptors. The contents of this collection is defined by matching the provided descriptors against all available font descriptors.
148    ///
149    /// # Safety
150    ///
151    /// - `query_descriptors` generic must be of the correct type.
152    /// - `options` generics must be of the correct type.
153    #[doc(alias = "CTFontCollectionCreateWithFontDescriptors")]
154    #[inline]
155    pub unsafe fn with_font_descriptors(
156        query_descriptors: Option<&CFArray>,
157        options: Option<&CFDictionary>,
158    ) -> CFRetained<CTFontCollection> {
159        extern "C-unwind" {
160            fn CTFontCollectionCreateWithFontDescriptors(
161                query_descriptors: Option<&CFArray>,
162                options: Option<&CFDictionary>,
163            ) -> Option<NonNull<CTFontCollection>>;
164        }
165        let ret = unsafe { CTFontCollectionCreateWithFontDescriptors(query_descriptors, options) };
166        let ret =
167            ret.expect("function was marked as returning non-null, but actually returned NULL");
168        unsafe { CFRetained::from_raw(ret) }
169    }
170
171    /// Returns a copy of the original collection augmented with the new font descriptors.
172    ///
173    ///
174    /// Parameter `original`: The original font collection reference.
175    ///
176    ///
177    /// Parameter `queryDescriptors`: An array of font descriptors to augment those of the original collection.
178    ///
179    ///
180    /// Parameter `options`: The options dictionary. See constant option keys.
181    ///
182    ///
183    /// Returns: This function creates a copy of the original font collection augmented by the new font descriptors and options. The new font descriptors are merged with the existing descriptors to create a single set.
184    ///
185    /// # Safety
186    ///
187    /// - `query_descriptors` generic must be of the correct type.
188    /// - `options` generics must be of the correct type.
189    #[doc(alias = "CTFontCollectionCreateCopyWithFontDescriptors")]
190    #[inline]
191    pub unsafe fn copy_with_font_descriptors(
192        &self,
193        query_descriptors: Option<&CFArray>,
194        options: Option<&CFDictionary>,
195    ) -> CFRetained<CTFontCollection> {
196        extern "C-unwind" {
197            fn CTFontCollectionCreateCopyWithFontDescriptors(
198                original: &CTFontCollection,
199                query_descriptors: Option<&CFArray>,
200                options: Option<&CFDictionary>,
201            ) -> Option<NonNull<CTFontCollection>>;
202        }
203        let ret = unsafe {
204            CTFontCollectionCreateCopyWithFontDescriptors(self, query_descriptors, options)
205        };
206        let ret =
207            ret.expect("function was marked as returning non-null, but actually returned NULL");
208        unsafe { CFRetained::from_raw(ret) }
209    }
210}
211
212impl CTMutableFontCollection {
213    /// Returns a mutable copy of the original collection.
214    ///
215    ///
216    /// Parameter `original`: The original font collection reference.
217    ///
218    ///
219    /// Returns: This function creates a mutable copy of the original font collection.
220    #[doc(alias = "CTFontCollectionCreateMutableCopy")]
221    #[inline]
222    pub unsafe fn new_copy(original: &CTFontCollection) -> CFRetained<CTMutableFontCollection> {
223        extern "C-unwind" {
224            fn CTFontCollectionCreateMutableCopy(
225                original: &CTFontCollection,
226            ) -> Option<NonNull<CTMutableFontCollection>>;
227        }
228        let ret = unsafe { CTFontCollectionCreateMutableCopy(original) };
229        let ret =
230            ret.expect("function was marked as returning non-null, but actually returned NULL");
231        unsafe { CFRetained::from_raw(ret) }
232    }
233}
234
235impl CTFontCollection {
236    /// Returns the array of descriptors to match.
237    ///
238    ///
239    /// Parameter `collection`: The font collection reference.
240    ///
241    ///
242    /// Returns: This function returns a retained reference to the array of descriptors to be used to query (match) the system font database. The return value is undefined if CTFontCollectionCreateFromAvailableFonts was used to create the collection.
243    #[doc(alias = "CTFontCollectionCopyQueryDescriptors")]
244    #[inline]
245    pub unsafe fn query_descriptors(&self) -> Option<CFRetained<CFArray>> {
246        extern "C-unwind" {
247            fn CTFontCollectionCopyQueryDescriptors(
248                collection: &CTFontCollection,
249            ) -> Option<NonNull<CFArray>>;
250        }
251        let ret = unsafe { CTFontCollectionCopyQueryDescriptors(self) };
252        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
253    }
254}
255
256impl CTMutableFontCollection {
257    /// Replaces the array of descriptors to match.
258    ///
259    ///
260    /// Parameter `collection`: The font collection reference.
261    ///
262    ///
263    /// Parameter `descriptors`: An array of CTFontDescriptorRef. May be NULL to represent an empty collection, in which case the matching descriptors will also be NULL.
264    ///
265    /// # Safety
266    ///
267    /// `descriptors` generic must be of the correct type.
268    #[doc(alias = "CTFontCollectionSetQueryDescriptors")]
269    #[inline]
270    pub unsafe fn set_query_descriptors(&self, descriptors: Option<&CFArray>) {
271        extern "C-unwind" {
272            fn CTFontCollectionSetQueryDescriptors(
273                collection: &CTMutableFontCollection,
274                descriptors: Option<&CFArray>,
275            );
276        }
277        unsafe { CTFontCollectionSetQueryDescriptors(self, descriptors) }
278    }
279}
280
281impl CTFontCollection {
282    /// Returns the array of descriptors to exclude from the match.
283    ///
284    ///
285    /// Parameter `collection`: The font collection reference.
286    ///
287    ///
288    /// Returns: This function returns a retained reference to the array of descriptors to be used to query (match) the system font database.
289    #[doc(alias = "CTFontCollectionCopyExclusionDescriptors")]
290    #[inline]
291    pub unsafe fn exclusion_descriptors(&self) -> Option<CFRetained<CFArray>> {
292        extern "C-unwind" {
293            fn CTFontCollectionCopyExclusionDescriptors(
294                collection: &CTFontCollection,
295            ) -> Option<NonNull<CFArray>>;
296        }
297        let ret = unsafe { CTFontCollectionCopyExclusionDescriptors(self) };
298        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
299    }
300}
301
302impl CTMutableFontCollection {
303    /// Replaces the array of descriptors to exclude from the match.
304    ///
305    ///
306    /// Parameter `collection`: The font collection reference.
307    ///
308    ///
309    /// Parameter `descriptors`: An array of CTFontDescriptorRef. May be NULL.
310    ///
311    /// # Safety
312    ///
313    /// `descriptors` generic must be of the correct type.
314    #[doc(alias = "CTFontCollectionSetExclusionDescriptors")]
315    #[inline]
316    pub unsafe fn set_exclusion_descriptors(&self, descriptors: Option<&CFArray>) {
317        extern "C-unwind" {
318            fn CTFontCollectionSetExclusionDescriptors(
319                collection: &CTMutableFontCollection,
320                descriptors: Option<&CFArray>,
321            );
322        }
323        unsafe { CTFontCollectionSetExclusionDescriptors(self, descriptors) }
324    }
325}
326
327impl CTFontCollection {
328    /// Returns an array of font descriptors matching the collection.
329    ///
330    ///
331    /// Parameter `collection`: The font collection reference.
332    ///
333    ///
334    /// Returns: An array of CTFontDescriptors matching the collection definition or NULL if there are none.
335    #[doc(alias = "CTFontCollectionCreateMatchingFontDescriptors")]
336    #[inline]
337    pub unsafe fn matching_font_descriptors(&self) -> Option<CFRetained<CFArray>> {
338        extern "C-unwind" {
339            fn CTFontCollectionCreateMatchingFontDescriptors(
340                collection: &CTFontCollection,
341            ) -> Option<NonNull<CFArray>>;
342        }
343        let ret = unsafe { CTFontCollectionCreateMatchingFontDescriptors(self) };
344        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
345    }
346
347    /// Returns the array of matching font descriptors sorted with the callback function.
348    ///
349    ///
350    /// Parameter `collection`: The collection reference.
351    ///
352    ///
353    /// Parameter `sortCallback`: The sorting callback function that defines the sort order.
354    ///
355    ///
356    /// Parameter `refCon`: Pointer to client data define context for the callback.
357    ///
358    ///
359    /// Returns: An array of CTFontDescriptors matching the criteria of the collection, sorted by the results of the sorting callback function, or NULL if there are none.
360    ///
361    /// # Safety
362    ///
363    /// - `sort_callback` must be implemented correctly.
364    /// - `ref_con` must be a valid pointer or null.
365    #[doc(alias = "CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback")]
366    #[cfg(feature = "CTFontDescriptor")]
367    #[inline]
368    pub unsafe fn matching_font_descriptors_sorted_with_callback(
369        &self,
370        sort_callback: CTFontCollectionSortDescriptorsCallback,
371        ref_con: *mut c_void,
372    ) -> Option<CFRetained<CFArray>> {
373        extern "C-unwind" {
374            fn CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback(
375                collection: &CTFontCollection,
376                sort_callback: CTFontCollectionSortDescriptorsCallback,
377                ref_con: *mut c_void,
378            ) -> Option<NonNull<CFArray>>;
379        }
380        let ret = unsafe {
381            CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback(
382                self,
383                sort_callback,
384                ref_con,
385            )
386        };
387        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
388    }
389
390    /// Returns an array of font descriptors matching the collection.
391    ///
392    ///
393    /// Parameter `collection`: The font collection reference.
394    ///
395    ///
396    /// Parameter `options`: The options dictionary. See constant option keys. May be NULL, in which case this call returns the same results as CTFontCollectionCreateMatchingFontDescriptors, using the options passed in when the collection was created.
397    ///
398    ///
399    /// Returns: An array of CTFontDescriptors matching the collection definition or NULL if there are none.
400    ///
401    /// # Safety
402    ///
403    /// `options` generics must be of the correct type.
404    #[doc(alias = "CTFontCollectionCreateMatchingFontDescriptorsWithOptions")]
405    #[inline]
406    pub unsafe fn matching_font_descriptors_with_options(
407        &self,
408        options: Option<&CFDictionary>,
409    ) -> Option<CFRetained<CFArray>> {
410        extern "C-unwind" {
411            fn CTFontCollectionCreateMatchingFontDescriptorsWithOptions(
412                collection: &CTFontCollection,
413                options: Option<&CFDictionary>,
414            ) -> Option<NonNull<CFArray>>;
415        }
416        let ret =
417            unsafe { CTFontCollectionCreateMatchingFontDescriptorsWithOptions(self, options) };
418        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
419    }
420
421    /// Returns an array of font descriptors matching the specified family, one descriptor for each style in the collection.
422    ///
423    ///
424    /// Parameter `collection`: The font collection reference.
425    ///
426    ///
427    /// Parameter `familyName`: The font family name
428    ///
429    ///
430    /// Returns: An array of CTFontDescriptors matching the specified family in the collection or NULL if there are none.
431    ///
432    /// # Safety
433    ///
434    /// `options` generics must be of the correct type.
435    #[doc(alias = "CTFontCollectionCreateMatchingFontDescriptorsForFamily")]
436    #[inline]
437    pub unsafe fn matching_font_descriptors_for_family(
438        &self,
439        family_name: &CFString,
440        options: Option<&CFDictionary>,
441    ) -> Option<CFRetained<CFArray>> {
442        extern "C-unwind" {
443            fn CTFontCollectionCreateMatchingFontDescriptorsForFamily(
444                collection: &CTFontCollection,
445                family_name: &CFString,
446                options: Option<&CFDictionary>,
447            ) -> Option<NonNull<CFArray>>;
448        }
449        let ret = unsafe {
450            CTFontCollectionCreateMatchingFontDescriptorsForFamily(self, family_name, options)
451        };
452        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
453    }
454}
455
456/// Option bits for use with CTFontCollectionCopyFontAttribute(s).
457///
458///
459/// Passing this option indicates that the return values should be sorted in standard UI order, suitable for display to the user. This is the same sorting behavior used by NSFontPanel and Font Book.
460///
461///
462/// Passing this option indicates that duplicate values should be removed from the results.
463///
464/// See also [Apple's documentation](https://developer.apple.com/documentation/coretext/ctfontcollectioncopyoptions?language=objc)
465// NS_OPTIONS
466#[repr(transparent)]
467#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
468pub struct CTFontCollectionCopyOptions(pub u32);
469bitflags::bitflags! {
470    impl CTFontCollectionCopyOptions: u32 {
471        #[doc(alias = "kCTFontCollectionCopyDefaultOptions")]
472        const DefaultOptions = 0;
473        #[doc(alias = "kCTFontCollectionCopyUnique")]
474        const Unique = 1<<0;
475        #[doc(alias = "kCTFontCollectionCopyStandardSort")]
476        const StandardSort = 1<<1;
477    }
478}
479
480#[cfg(feature = "objc2")]
481unsafe impl Encode for CTFontCollectionCopyOptions {
482    const ENCODING: Encoding = u32::ENCODING;
483}
484
485#[cfg(feature = "objc2")]
486unsafe impl RefEncode for CTFontCollectionCopyOptions {
487    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
488}
489
490impl CTFontCollection {
491    /// Returns an array of font descriptor attribute values.
492    ///
493    ///
494    /// Parameter `collection`: The font collection reference.
495    ///
496    ///
497    /// Parameter `attributeName`: The attribute to retrieve for each descriptor in the collection.
498    ///
499    ///
500    /// Parameter `options`: Options to alter the return value.
501    ///
502    ///
503    /// Returns: An array containing one value for each descriptor. With kCTFontCollectionCopyDefaultOptions, the values will be in the same order as the results from CTFontCollectionCreateMatchingFontDescriptors and NULL values will be transformed to kCFNull. When the kCTFontCollectionCopyUnique is set, duplicate values will be removed. When kCTFontCollectionCopyStandardSort is set, the values will be sorted in standard UI order.
504    #[doc(alias = "CTFontCollectionCopyFontAttribute")]
505    #[inline]
506    pub unsafe fn font_attribute(
507        &self,
508        attribute_name: &CFString,
509        options: CTFontCollectionCopyOptions,
510    ) -> CFRetained<CFArray> {
511        extern "C-unwind" {
512            fn CTFontCollectionCopyFontAttribute(
513                collection: &CTFontCollection,
514                attribute_name: &CFString,
515                options: CTFontCollectionCopyOptions,
516            ) -> Option<NonNull<CFArray>>;
517        }
518        let ret = unsafe { CTFontCollectionCopyFontAttribute(self, attribute_name, options) };
519        let ret =
520            ret.expect("function was marked as returning non-null, but actually returned NULL");
521        unsafe { CFRetained::from_raw(ret) }
522    }
523
524    /// Returns an array of dictionaries containing font descriptor attribute values.
525    ///
526    ///
527    /// Parameter `collection`: The font collection reference.
528    ///
529    ///
530    /// Parameter `attributeNames`: The attributes to retrieve for each descriptor in the collection.
531    ///
532    ///
533    /// Parameter `options`: Options to alter the return value.
534    ///
535    ///
536    /// Returns: An array containing one CFDictionary value for each descriptor mapping the requested attribute names. With kCTFontCollectionCopyDefaultOptions, the values will be in the same order as the results from CTFontCollectionCreateMatchingFontDescriptors. When the kCTFontCollectionCopyUnique is set, duplicate values will be removed. When kCTFontCollectionCopyStandardSort is set, the values will be sorted in standard UI order.
537    ///
538    /// # Safety
539    ///
540    /// `attribute_names` generic must be of the correct type.
541    #[doc(alias = "CTFontCollectionCopyFontAttributes")]
542    #[inline]
543    pub unsafe fn font_attributes(
544        &self,
545        attribute_names: &CFSet,
546        options: CTFontCollectionCopyOptions,
547    ) -> CFRetained<CFArray> {
548        extern "C-unwind" {
549            fn CTFontCollectionCopyFontAttributes(
550                collection: &CTFontCollection,
551                attribute_names: &CFSet,
552                options: CTFontCollectionCopyOptions,
553            ) -> Option<NonNull<CFArray>>;
554        }
555        let ret = unsafe { CTFontCollectionCopyFontAttributes(self, attribute_names, options) };
556        let ret =
557            ret.expect("function was marked as returning non-null, but actually returned NULL");
558        unsafe { CFRetained::from_raw(ret) }
559    }
560}
561
562#[deprecated = "renamed to `CTFontCollection::from_available_fonts`"]
563#[inline]
564pub unsafe extern "C-unwind" fn CTFontCollectionCreateFromAvailableFonts(
565    options: Option<&CFDictionary>,
566) -> CFRetained<CTFontCollection> {
567    extern "C-unwind" {
568        fn CTFontCollectionCreateFromAvailableFonts(
569            options: Option<&CFDictionary>,
570        ) -> Option<NonNull<CTFontCollection>>;
571    }
572    let ret = unsafe { CTFontCollectionCreateFromAvailableFonts(options) };
573    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
574    unsafe { CFRetained::from_raw(ret) }
575}
576
577#[deprecated = "renamed to `CTFontCollection::with_font_descriptors`"]
578#[inline]
579pub unsafe extern "C-unwind" fn CTFontCollectionCreateWithFontDescriptors(
580    query_descriptors: Option<&CFArray>,
581    options: Option<&CFDictionary>,
582) -> CFRetained<CTFontCollection> {
583    extern "C-unwind" {
584        fn CTFontCollectionCreateWithFontDescriptors(
585            query_descriptors: Option<&CFArray>,
586            options: Option<&CFDictionary>,
587        ) -> Option<NonNull<CTFontCollection>>;
588    }
589    let ret = unsafe { CTFontCollectionCreateWithFontDescriptors(query_descriptors, options) };
590    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
591    unsafe { CFRetained::from_raw(ret) }
592}
593
594#[deprecated = "renamed to `CTFontCollection::copy_with_font_descriptors`"]
595#[inline]
596pub unsafe extern "C-unwind" fn CTFontCollectionCreateCopyWithFontDescriptors(
597    original: &CTFontCollection,
598    query_descriptors: Option<&CFArray>,
599    options: Option<&CFDictionary>,
600) -> CFRetained<CTFontCollection> {
601    extern "C-unwind" {
602        fn CTFontCollectionCreateCopyWithFontDescriptors(
603            original: &CTFontCollection,
604            query_descriptors: Option<&CFArray>,
605            options: Option<&CFDictionary>,
606        ) -> Option<NonNull<CTFontCollection>>;
607    }
608    let ret = unsafe {
609        CTFontCollectionCreateCopyWithFontDescriptors(original, query_descriptors, options)
610    };
611    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
612    unsafe { CFRetained::from_raw(ret) }
613}
614
615#[deprecated = "renamed to `CTMutableFontCollection::new_copy`"]
616#[inline]
617pub unsafe extern "C-unwind" fn CTFontCollectionCreateMutableCopy(
618    original: &CTFontCollection,
619) -> CFRetained<CTMutableFontCollection> {
620    extern "C-unwind" {
621        fn CTFontCollectionCreateMutableCopy(
622            original: &CTFontCollection,
623        ) -> Option<NonNull<CTMutableFontCollection>>;
624    }
625    let ret = unsafe { CTFontCollectionCreateMutableCopy(original) };
626    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
627    unsafe { CFRetained::from_raw(ret) }
628}
629
630#[deprecated = "renamed to `CTFontCollection::query_descriptors`"]
631#[inline]
632pub unsafe extern "C-unwind" fn CTFontCollectionCopyQueryDescriptors(
633    collection: &CTFontCollection,
634) -> Option<CFRetained<CFArray>> {
635    extern "C-unwind" {
636        fn CTFontCollectionCopyQueryDescriptors(
637            collection: &CTFontCollection,
638        ) -> Option<NonNull<CFArray>>;
639    }
640    let ret = unsafe { CTFontCollectionCopyQueryDescriptors(collection) };
641    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
642}
643
644extern "C-unwind" {
645    #[deprecated = "renamed to `CTMutableFontCollection::set_query_descriptors`"]
646    pub fn CTFontCollectionSetQueryDescriptors(
647        collection: &CTMutableFontCollection,
648        descriptors: Option<&CFArray>,
649    );
650}
651
652#[deprecated = "renamed to `CTFontCollection::exclusion_descriptors`"]
653#[inline]
654pub unsafe extern "C-unwind" fn CTFontCollectionCopyExclusionDescriptors(
655    collection: &CTFontCollection,
656) -> Option<CFRetained<CFArray>> {
657    extern "C-unwind" {
658        fn CTFontCollectionCopyExclusionDescriptors(
659            collection: &CTFontCollection,
660        ) -> Option<NonNull<CFArray>>;
661    }
662    let ret = unsafe { CTFontCollectionCopyExclusionDescriptors(collection) };
663    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
664}
665
666extern "C-unwind" {
667    #[deprecated = "renamed to `CTMutableFontCollection::set_exclusion_descriptors`"]
668    pub fn CTFontCollectionSetExclusionDescriptors(
669        collection: &CTMutableFontCollection,
670        descriptors: Option<&CFArray>,
671    );
672}
673
674#[deprecated = "renamed to `CTFontCollection::matching_font_descriptors`"]
675#[inline]
676pub unsafe extern "C-unwind" fn CTFontCollectionCreateMatchingFontDescriptors(
677    collection: &CTFontCollection,
678) -> Option<CFRetained<CFArray>> {
679    extern "C-unwind" {
680        fn CTFontCollectionCreateMatchingFontDescriptors(
681            collection: &CTFontCollection,
682        ) -> Option<NonNull<CFArray>>;
683    }
684    let ret = unsafe { CTFontCollectionCreateMatchingFontDescriptors(collection) };
685    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
686}
687
688#[cfg(feature = "CTFontDescriptor")]
689#[deprecated = "renamed to `CTFontCollection::matching_font_descriptors_sorted_with_callback`"]
690#[inline]
691pub unsafe extern "C-unwind" fn CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback(
692    collection: &CTFontCollection,
693    sort_callback: CTFontCollectionSortDescriptorsCallback,
694    ref_con: *mut c_void,
695) -> Option<CFRetained<CFArray>> {
696    extern "C-unwind" {
697        fn CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback(
698            collection: &CTFontCollection,
699            sort_callback: CTFontCollectionSortDescriptorsCallback,
700            ref_con: *mut c_void,
701        ) -> Option<NonNull<CFArray>>;
702    }
703    let ret = unsafe {
704        CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback(
705            collection,
706            sort_callback,
707            ref_con,
708        )
709    };
710    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
711}
712
713#[deprecated = "renamed to `CTFontCollection::matching_font_descriptors_with_options`"]
714#[inline]
715pub unsafe extern "C-unwind" fn CTFontCollectionCreateMatchingFontDescriptorsWithOptions(
716    collection: &CTFontCollection,
717    options: Option<&CFDictionary>,
718) -> Option<CFRetained<CFArray>> {
719    extern "C-unwind" {
720        fn CTFontCollectionCreateMatchingFontDescriptorsWithOptions(
721            collection: &CTFontCollection,
722            options: Option<&CFDictionary>,
723        ) -> Option<NonNull<CFArray>>;
724    }
725    let ret =
726        unsafe { CTFontCollectionCreateMatchingFontDescriptorsWithOptions(collection, options) };
727    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
728}
729
730#[deprecated = "renamed to `CTFontCollection::matching_font_descriptors_for_family`"]
731#[inline]
732pub unsafe extern "C-unwind" fn CTFontCollectionCreateMatchingFontDescriptorsForFamily(
733    collection: &CTFontCollection,
734    family_name: &CFString,
735    options: Option<&CFDictionary>,
736) -> Option<CFRetained<CFArray>> {
737    extern "C-unwind" {
738        fn CTFontCollectionCreateMatchingFontDescriptorsForFamily(
739            collection: &CTFontCollection,
740            family_name: &CFString,
741            options: Option<&CFDictionary>,
742        ) -> Option<NonNull<CFArray>>;
743    }
744    let ret = unsafe {
745        CTFontCollectionCreateMatchingFontDescriptorsForFamily(collection, family_name, options)
746    };
747    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
748}
749
750#[deprecated = "renamed to `CTFontCollection::font_attribute`"]
751#[inline]
752pub unsafe extern "C-unwind" fn CTFontCollectionCopyFontAttribute(
753    collection: &CTFontCollection,
754    attribute_name: &CFString,
755    options: CTFontCollectionCopyOptions,
756) -> CFRetained<CFArray> {
757    extern "C-unwind" {
758        fn CTFontCollectionCopyFontAttribute(
759            collection: &CTFontCollection,
760            attribute_name: &CFString,
761            options: CTFontCollectionCopyOptions,
762        ) -> Option<NonNull<CFArray>>;
763    }
764    let ret = unsafe { CTFontCollectionCopyFontAttribute(collection, attribute_name, options) };
765    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
766    unsafe { CFRetained::from_raw(ret) }
767}
768
769#[deprecated = "renamed to `CTFontCollection::font_attributes`"]
770#[inline]
771pub unsafe extern "C-unwind" fn CTFontCollectionCopyFontAttributes(
772    collection: &CTFontCollection,
773    attribute_names: &CFSet,
774    options: CTFontCollectionCopyOptions,
775) -> CFRetained<CFArray> {
776    extern "C-unwind" {
777        fn CTFontCollectionCopyFontAttributes(
778            collection: &CTFontCollection,
779            attribute_names: &CFSet,
780            options: CTFontCollectionCopyOptions,
781        ) -> Option<NonNull<CFArray>>;
782    }
783    let ret = unsafe { CTFontCollectionCopyFontAttributes(collection, attribute_names, options) };
784    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
785    unsafe { CFRetained::from_raw(ret) }
786}