CTFontDescriptor

A font descriptor.

Overview

A font descriptor is a dictionary of attributes (such as name, point size, and variation) that can completely specify a font.

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

Topics

Creating Font Descriptors

func CTFontDescriptorCreateWithNameAndSize(CFString, CGFloat) -> CTFontDescriptor

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

func CTFontDescriptorCreateWithAttributes(CFDictionary) -> CTFontDescriptor

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

func CTFontDescriptorCreateCopyWithAttributes(CTFontDescriptor, CFDictionary) -> CTFontDescriptor

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

func CTFontDescriptorCreateCopyWithVariation(CTFontDescriptor, CFNumber, CGFloat) -> CTFontDescriptor

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

func CTFontDescriptorCreateCopyWithFamily(CTFontDescriptor, CFString) -> CTFontDescriptor?

Creates a copy of the font descriptor in the specified family based on the traits of the original.

func CTFontDescriptorCreateCopyWithSymbolicTraits(CTFontDescriptor, CTFontSymbolicTraits, CTFontSymbolicTraits) -> CTFontDescriptor?

Creates a copy of the font descriptor with the specified symbolic traits as the original.

func CTFontDescriptorCreateMatchingFontDescriptors(CTFontDescriptor, CFSet?) -> CFArray?

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

func CTFontDescriptorCreateMatchingFontDescriptor(CTFontDescriptor, CFSet?) -> CTFontDescriptor?

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

Getting Attributes

Getting the Font Descriptor Type

func CTFontDescriptorGetTypeID() -> CFTypeID

Returns the type identifier for Core Text font descriptor references.

Data Types

Accessing Font Attributes

Font Attributes

The keys for accessing font attributes from a font descriptor.

enum CTFontOrientation

The intended rendering orientation of the font for obtaining glyph metrics.

enum CTFontFormat

The recognized format of the font.

typealias CTFontPriority

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

Accessing Font Traits

Font Traits

The keys for accessing font traits from a font descriptor.

struct CTFontSymbolicTraits

The symbolic representation of stylistic font attributes.

struct CTFontStylisticClass

The stylistic class values of the font.

See Also

Opaque Types

CTFont

A font object.

CTFramesetter

Generate text frames.

CTGlyphInfo

Override a font's specified mapping from Unicode to the glyph ID.

CTLine

A line of text.

CTParagraphStyle

Paragraph or ruler attributes in an attributed string.

CTTextTab

A tab in a paragraph style, storing an alignment type and location.

CTTypesetter

A typesetter which performs line layout.