CTFontDescriptor

The CTFontDescriptor opaque type represents a font descriptor, that is, a dictionary of attributes (such as name, point size, and variation) that can completely specify a font.

Overview

A font descriptor can be an incomplete specification, in which case the system chooses the most appropriate font to match the given attributes.

Symbols

Creating Font Descriptors

func CTFontDescriptorCreateWithNameAndSize(CFString, CGFloat)

Creates a new font descriptor with the provided PostScript name and size.

func CTFontDescriptorCreateWithAttributes(CFDictionary)

Creates a new font descriptor reference from a dictionary of attributes.

func CTFontDescriptorCreateCopyWithAttributes(CTFontDescriptor, CFDictionary)

Creates a copy of the original font descriptor with new attributes.

func CTFontDescriptorCreateCopyWithVariation(CTFontDescriptor, CFNumber, CGFloat)

Creates a copy of the original font descriptor with a new variation instance.

func CTFontDescriptorCreateMatchingFontDescriptors(CTFontDescriptor, CFSet?)

Returns an array of normalized font descriptors matching the provided descriptor.

func CTFontDescriptorCreateMatchingFontDescriptor(CTFontDescriptor, CFSet?)

Returns the single preferred matching font descriptor based on the original descriptor and system precedence.

Getting Attributes

func CTFontDescriptorCopyAttributes(CTFontDescriptor)

Returns the attributes dictionary of the font descriptor.

func CTFontDescriptorCopyAttribute(CTFontDescriptor, CFString)

Returns the value associated with an arbitrary attribute.

Getting the Font Descriptor Type

func CTFontDescriptorGetTypeID()

Returns the type identifier for Core Text font descriptor references.

Data Types

CTFontDescriptor

A reference to a CTFontDescriptor object.

Font Attributes

Font Attribute Constants

These constants are keys for accessing font attributes from a font descriptor.

CTFontOrientation

Specifies the intended rendering orientation of the font for obtaining glyph metrics. These constants are used as values of kCTFontOrientationAttribute.

CTFontFormat

Specifies the recognized format of the font.

CTFontPriority

Specifies the priority of font descriptors when resolving duplicates and sorting match results.

Font Traits

Font Trait Constants

These constants are keys for accessing font traits from a font descriptor.

CTFontSymbolicTraits

These constants represent the symbolic representation of stylistic font attributes.

CTFontStylisticClass

These constants represent the stylistic class values of the font.