Returns a new font reference that best matches the given font descriptor.


func CTFontCreateWithFontDescriptor(_ descriptor: CTFontDescriptor, _ size: CGFloat, _ matrix: UnsafePointer<CGAffineTransform>?) -> CTFont



A font descriptor containing attributes that specify the requested font.


The point size for the font reference. If 0.0 is specified, the default font size of 12.0 is used. This parameter is optional.


The transformation matrix for the font. In most cases, set this parameter to be NULL. If NULL is specified, the identity matrix is used. This parameter is optional.

Return Value

A CTFontRef that best matches the attributes provided with the font descriptor.


The size and matrix parameters override any specified in the font descriptor unless they are unspecified (0.0 for size and NULL for matrix). A best match font is always returned, and default values are used for any unspecified parameters.

See Also

Creating Fonts

func CTFontCreateUIFontForLanguage(CTFontUIFontType, CGFloat, CFString?) -> CTFont?

Returns the special user-interface font for the given language and user-interface type.

func CTFontCreateCopyWithFamily(CTFont, CGFloat, UnsafePointer<CGAffineTransform>?, CFString) -> CTFont?

Returns a new font in the specified family based on the traits of the original font.

func CTFontCreateForString(CTFont, CFString, CFRange) -> CTFont

Returns a new font reference that can best map the given string range based on the current font.