<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIFontDescriptor",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIFontDescriptor"
  },
  "title" : "UIFontDescriptor"
}
-->

# UIFontDescriptor

A collection of attributes that describes a font.

```
class UIFontDescriptor
```

## Overview

A font descriptor can be used to create or modify a [`UIFont`](/documentation/UIKit/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:)`](/documentation/UIKit/UIFontDescriptor/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`](/documentation/UIKit/UIFontDescriptor) object. To take advantage of text styles and respect the user’s current content size category, use [`preferredFontDescriptor(withTextStyle:)`](/documentation/UIKit/UIFontDescriptor/preferredFontDescriptor(withTextStyle:)). You can also use `alloc` and [`init(fontAttributes:)`](/documentation/UIKit/UIFontDescriptor/init(fontAttributes:)), [`fontDescriptorWithFontAttributes:`](/documentation/UIKit/UIFontDescriptor/fontDescriptorWithFontAttributes:), [`init(name:matrix:)`](/documentation/UIKit/UIFontDescriptor/init(name:matrix:)), or [`init(name:size:)`](/documentation/UIKit/UIFontDescriptor/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(_:)`](/documentation/UIKit/UIFontDescriptor/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](https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/typography/).

## Topics

### Creating a font descriptor

[`+  preferredFontDescriptorWithTextStyle:`](/documentation/UIKit/UIFontDescriptor/preferredFontDescriptor(withTextStyle:))

Returns a font descriptor that contains the specified text style and the user’s selected content size category.

[`+  preferredFontDescriptorWithTextStyle:compatibleWithTraitCollection:`](/documentation/UIKit/UIFontDescriptor/preferredFontDescriptor(withTextStyle:compatibleWith:))

Returns a font descriptor that contains the text style and the content size category that the provided trait collection specifies.

[`+  fontDescriptorWithFontAttributes:`](/documentation/UIKit/UIFontDescriptor/fontDescriptorWithFontAttributes:)

Returns a font descriptor with a dictionary of attributes.

[`+  fontDescriptorWithName:matrix:`](/documentation/UIKit/UIFontDescriptor/init(name:matrix:))

Returns a font descriptor with the specified values for the name and matrix dictionary attributes.

[`+  fontDescriptorWithName:size:`](/documentation/UIKit/UIFontDescriptor/init(name:size:))

Returns a font descriptor with the specified values for the name and size dictionary attributes.

[`-  fontDescriptorByAddingAttributes:`](/documentation/UIKit/UIFontDescriptor/addingAttributes(_:))

Returns a new font descriptor that’s the same as the existing descriptor, but with the specified attributes taking precedence over the existing ones.

[`-  fontDescriptorWithDesign:`](/documentation/UIKit/UIFontDescriptor/withDesign(_:))

Returns a new font descriptor that’s the same as the existing descriptor, but with the specified design.

[`-  fontDescriptorWithFamily:`](/documentation/UIKit/UIFontDescriptor/withFamily(_:))

Returns a new font descriptor whose attributes are the same as the existing font descriptor, but from the specified family.

[`-  fontDescriptorWithFace:`](/documentation/UIKit/UIFontDescriptor/withFace(_:))

Returns a new font descriptor that’s the same as the existing font descriptor, but with the specified face.

[`-  fontDescriptorWithMatrix:`](/documentation/UIKit/UIFontDescriptor/withMatrix(_:))

Returns a new font descriptor that’s the same as the existing font descriptor, but with the specified matrix.

[`-  fontDescriptorWithSize:`](/documentation/UIKit/UIFontDescriptor/withSize(_:))

Returns a new font descriptor that’s the same as the existing font descriptor, but with the specified point size.

[`-  fontDescriptorWithSymbolicTraits:`](/documentation/UIKit/UIFontDescriptor/withSymbolicTraits(_:))

Returns a new font descriptor that’s the same as the existing font descriptor, but with the specified symbolic traits.

### Initializing a font descriptor

[`-  initWithFontAttributes:`](/documentation/UIKit/UIFontDescriptor/init(fontAttributes:))

Creates a font descriptor with the specified attributes.

[`-  init`](/documentation/UIKit/UIFontDescriptor/init())

Creates a font descriptor.

[`-  initWithCoder:`](/documentation/UIKit/UIFontDescriptor/init(coder:))

Creates a font descriptor from data in an unarchiver.

### Finding fonts

[`-  matchingFontDescriptorsWithMandatoryKeys:`](/documentation/UIKit/UIFontDescriptor/matchingFontDescriptors(withMandatoryKeys:))

Returns all the fonts available in the system with specified attributes that match those of the font.

### Querying a font descriptor

[`fontAttributes`](/documentation/UIKit/UIFontDescriptor/fontAttributes)

The font descriptor’s dictionary of attributes.

[`matrix`](/documentation/UIKit/UIFontDescriptor/matrix)

The current transform matrix of the font descriptor.

[`-  objectForKey:`](/documentation/UIKit/UIFontDescriptor/object(forKey:))

Returns the font attribute that the corresponding key specifies.

[`pointSize`](/documentation/UIKit/UIFontDescriptor/pointSize)

The point size of the font descriptor.

[`postscriptName`](/documentation/UIKit/UIFontDescriptor/postscriptName)

The PostScript name of the font descriptor.

[`symbolicTraits`](/documentation/UIKit/UIFontDescriptor/symbolicTraits-swift.property)

The traits of the font descriptor.

[`SymbolicTraits`](/documentation/UIKit/UIFontDescriptor/SymbolicTraits-swift.struct)

Constants that describe the stylistic aspects of a font.

### Constants

[`TextStyle`](/documentation/UIKit/UIFont/TextStyle)

Constants that describe the preferred styles for fonts.

[`SystemDesign`](/documentation/UIKit/UIFontDescriptor/SystemDesign)

Constants that describe the system-defined typeface designs.

[`SymbolicTraits`](/documentation/UIKit/UIFontDescriptor/SymbolicTraits-swift.struct)

Constants that describe the stylistic aspects of a font.

[`Class`](/documentation/UIKit/UIFontDescriptor/Class)

Constants that classify certain stylistic qualities of the font.

[`AttributeName`](/documentation/UIKit/UIFontDescriptor/AttributeName)

Constants that describe font attributes.

[`FeatureKey`](/documentation/UIKit/UIFontDescriptor/FeatureKey)

Keys for retrieving feature settings.

[`TraitKey`](/documentation/UIKit/UIFontDescriptor/TraitKey)

Keys for retrieving the font descriptor’s trait information.

[`Weight`](/documentation/UIKit/UIFont/Weight)

Constants that represent standard typeface styles.

[`Width`](/documentation/UIKit/UIFont/Width)

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`Hashable`](/documentation/Swift/Hashable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)