Function

CTFontCreateWithName(_:_:_:)

Returns a new font reference for the given name.

Declaration

func CTFontCreateWithName(_ name: CFString, _ size: CGFloat, _ matrix: UnsafePointer<CGAffineTransform>?) -> CTFont

Parameters

name

The font name for which you wish to create a new font reference. A valid PostScript name is preferred, although other font name types are matched in a fallback manner.

size

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.

matrix

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

Returns a CTFontRef that best matches the name provided with size and matrix attributes.

Discussion

The name parameter is the only required parameter, and default values are used for unspecified parameters (0.0 for size and NULL for matrix). If all parameters cannot be matched identically, a best match is found.

See Also

Creating Fonts

func CTFontCreateWithFontDescriptor(CTFontDescriptor, CGFloat, UnsafePointer<CGAffineTransform>?) -> CTFont

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

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.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software