iOS Developer Library

Developer

ApplicationServices Framework Reference CTFontCollection Reference

Options
Deployment Target:

On This Page
Language:

CTFontCollection Reference

The CTFontCollection opaque type represents a font collection, that is, a group of font descriptors taken together as a single object.

Font collections provide the capabilities of font enumeration, access to global and custom font collections, and access to the font descriptors comprising the collection.

Functions

  • Returns a new font collection containing all available fonts.

    Declaration

    Swift

    func CTFontCollectionCreateFromAvailableFonts(_ options: CFDictionary!) -> CTFontCollection!

    Objective-C

    CTFontCollectionRef CTFontCollectionCreateFromAvailableFonts ( CFDictionaryRef options );

    Parameters

    options

    The options dictionary. For possible values, see Constants.

    Return Value

    A new collection containing all fonts available to the current application.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns a new font collection based on the given array of font descriptors.

    Declaration

    Swift

    func CTFontCollectionCreateWithFontDescriptors(_ descriptors: CFArray!, _ options: CFDictionary!) -> CTFontCollection!

    Objective-C

    CTFontCollectionRef CTFontCollectionCreateWithFontDescriptors ( CFArrayRef queryDescriptors, CFDictionaryRef options );

    Parameters

    descriptors

    An array of font descriptors.

    options

    The options dictionary. For possible values, see Constants.

    Return Value

    A new font collection based on the provided font descriptors.

    Discussion

    The contents of the returned collection are defined by matching the provided descriptors against all available font descriptors.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns a copy of the original collection augmented with the given new font descriptors.

    Declaration

    Swift

    func CTFontCollectionCreateCopyWithFontDescriptors(_ original: CTFontCollection!, _ descriptors: CFArray!, _ options: CFDictionary!) -> CTFontCollection!

    Objective-C

    CTFontCollectionRef CTFontCollectionCreateCopyWithFontDescriptors ( CTFontCollectionRef original, CFArrayRef queryDescriptors, CFDictionaryRef options );

    Parameters

    original

    The original font collection reference.

    descriptors

    An array of font descriptors to augment those of the original collection.

    options

    The options dictionary. For possible values, see Constants.

    Return Value

    A copy of the original font collection augmented by the new font descriptors and options.

    Discussion

    The new font descriptors are merged with the existing descriptors to create a single set.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns an array of font descriptors matching the collection.

    Declaration

    Swift

    func CTFontCollectionCreateMatchingFontDescriptors(_ collection: CTFontCollection!) -> CFArray!

    Objective-C

    CFArrayRef CTFontCollectionCreateMatchingFontDescriptors ( CTFontCollectionRef collection );

    Parameters

    collection

    The font collection reference.

    Return Value

    A retained reference to an array of normalized font descriptors matching the collection definition.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the array of matching font descriptors sorted with the callback function.

    Declaration

    Swift

    func CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback(_ collection: CTFontCollection!, _ sortCallback: CTFontCollectionSortDescriptorsCallback, _ refCon: UnsafeMutablePointer<Void>) -> CFArray!

    Objective-C

    CFArrayRef CTFontCollectionCreateMatchingFontDescriptorsSortedWithCallback ( CTFontCollectionRef collection, CTFontCollectionSortDescriptorsCallback sortCallback, void *refCon );

    Parameters

    collection

    The collection reference.

    sortCallback

    The sorting callback function that defines the sort order.

    refCon

    Pointer to client data define context for the callback.

    Return Value

    An array of font descriptors matching the criteria of the collection sorted by the results of the sorting callback function.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • Returns the matching font descriptors of a collection in sorted order.

    Declaration

    Objective-C

    typedef CFComparisonResult (*CTFontCollectionSortDescriptorsCallback) ( CTFontDescriptorRef first, CTFontDescriptorRef second, void *refCon);

    Parameters

    CTFontDescriptorRef first

    The first descriptor.

    CTFontDescriptorRef second

    The second descriptor.

    refCon

    Pointer to client data define context for the callback.

    Return Value

    The matching font descriptors of a collection in sorted order.

  • Returns the type identifier for Core Text font collection references.

    Declaration

    Swift

    func CTFontCollectionGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID CTFontCollectionGetTypeID ( void );

    Return Value

    The identifier for the opaque type CTFontCollection.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

Data Types

  • A reference to a font collection.

    Declaration

    Swift

    typealias CTFontCollectionRef = CTFontCollection

    Objective-C

    typedef const struct __CTFontCollection * CTFontCollectionRef;

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 3.2 and later.

  • A reference to a mutable font collection.

    Declaration

    Swift

    typealias CTMutableFontCollectionRef = CTMutableFontCollection

    Objective-C

    typedef struct __CTFontCollection * CTMutableFontCollectionRef;

    Discussion

    An opaque reference to a mutable font collection.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 4.0 and later.

Constants

  • An option key to specify filtering of duplicates.

    Declaration

    Swift

    let kCTFontCollectionRemoveDuplicatesOption: CFString!

    Objective-C

    const CFStringRef kCTFontCollectionRemoveDuplicatesOption;

    Constants

    • kCTFontCollectionRemoveDuplicatesOption

      kCTFontCollectionRemoveDuplicatesOption

      Option key to specify filtering of duplicates.

      Available in iOS 3.2 and later.

    Discussion

    Specify this option key in the options dictionary with a nonzero value to enable automatic filtering of duplicate font descriptors.

  • Option bits for use with CTFontCollectionCopyFontAttribute(s).

    Declaration

    Swift

    typealias CTFontCollectionCopyOptions = UInt32

    Objective-C

    enum { kCTFontCollectionCopyDefaultOptions = 0, kCTFontCollectionCopyUnique = (1L << 0), kCTFontCollectionCopyStandardSort = (1L << 1) }; typedef uint32_t CTFontCollectionCopyOptions;

    Constants

    • kCTFontCollectionCopyDefaultOptions

      kCTFontCollectionCopyDefaultOptions

      Passing this option indicates that defaults are to be used.

      Available in iOS 4.2 and later.

    • kCTFontCollectionCopyStandardSort

      kCTFontCollectionCopyStandardSort

      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.

      Available in iOS 4.2 and later.

    • kCTFontCollectionCopyUnique

      kCTFontCollectionCopyUnique

      Passing this option indicates that duplicate values should be removed from the results.

      Available in iOS 4.2 and later.

    Import Statement

    Objective-C

    @import CoreText;

    Swift

    import CoreText

    Availability

    Available in iOS 4.2 and later.