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