Describes a font with a dictionary of attributes.
- iOS 7.0+
- tvOS 9.0+
- watchOS 2.0+
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
matching 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
UIFont object. To take advantage of text styles and respect the user’s current content size category, use
preferred. You can also use
init(name: 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
font instance methods (such as
with) 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.