Contents

UIFontDescriptor

A collection of attributes that describes a font.

Declaration

class UIFontDescriptor

Overview

A font descriptor can be used to create or modify a UIFont object. Font descriptors have a font matching capability, so that you can partially describe a font by creating a font descriptor with, for example, just a family name. You can use matchingFontDescriptors(withMandatoryKeys:) to find all the available fonts in the system with a matching family name. Font descriptors can also be archived and unarchived.

There are several ways to create a new UIFontDescriptor object. To take advantage of text styles and respect the user’s current content size category, use preferredFontDescriptor(withTextStyle:). You can also use alloc and init(fontAttributes:), fontDescriptorWithFontAttributes:, init(name:matrix:), or init(name:size:) to create a font descriptor based on your custom attributes dictionary or on a specific font’s name and size. Alternatively you can use one of the fontDescriptor… instance methods (such as withFace(_:)) to create a modified version of an existing descriptor. The latter methods are useful if you have an existing descriptor and simply want to change one aspect.

All attributes in the attributes dictionary are optional.

For design guidance, see Human Interface Guidelines.

Topics

Creating a font descriptor

Initializing a font descriptor

Finding fonts

Querying a font descriptor

Constants

See Also

Fonts