<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSFontDescriptor",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFontDescriptor"
  },
  "title" : "NSFontDescriptor"
}
-->

# NSFontDescriptor

A dictionary of attributes that describe a font.

```
class NSFontDescriptor
```

## Overview

A font descriptor can be used to create or modify an [`NSFont`](/documentation/AppKit/NSFont) object. The system provides 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 then find all the available fonts on the system with a matching family name using [`matchingFontDescriptors(withMandatoryKeys:)`](/documentation/AppKit/NSFontDescriptor/matchingFontDescriptors(withMandatoryKeys:)).

There are several ways to create a new [`NSFontDescriptor`](/documentation/AppKit/NSFontDescriptor) object. You can use `alloc` and  [`init(fontAttributes:)`](/documentation/AppKit/NSFontDescriptor/init(fontAttributes:)), [`fontDescriptorWithFontAttributes:`](/documentation/AppKit/NSFontDescriptor/fontDescriptorWithFontAttributes:), [`init(name:matrix:)`](/documentation/AppKit/NSFontDescriptor/init(name:matrix:)), or [`init(name:size:)`](/documentation/AppKit/NSFontDescriptor/init(name:size:)). to create a font descriptor based on either 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/AppKit/NSFontDescriptor/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.

## Topics

### Creating a Font Descriptor

[`preferredFontDescriptor(forTextStyle:options:)`](/documentation/AppKit/NSFontDescriptor/preferredFontDescriptor(forTextStyle:options:))

Returns a font descriptor that contains the text style.

[`fontDescriptorWithFontAttributes:`](/documentation/AppKit/NSFontDescriptor/fontDescriptorWithFontAttributes:)

Returns a font descriptor with a dictionary of attributes.

[`init(name:matrix:)`](/documentation/AppKit/NSFontDescriptor/init(name:matrix:))

Returns a font descriptor with the name and matrix attributes set to the given values.

[`init(name:size:)`](/documentation/AppKit/NSFontDescriptor/init(name:size:))

Returns a font descriptor with the name and size attributes set to the given values.

[`init(fontAttributes:)`](/documentation/AppKit/NSFontDescriptor/init(fontAttributes:))

Initializes and returns a new font descriptor with the specified attributes.

### Modifying an Existing Font Descriptor

[`addingAttributes(_:)`](/documentation/AppKit/NSFontDescriptor/addingAttributes(_:))

Returns a new font descriptor based on the current object, but with the specified attributes taking precedence over the existing ones.

[`withFace(_:)`](/documentation/AppKit/NSFontDescriptor/withFace(_:))

Returns a new font descriptor based on the current object, but with the specified face.

[`withFamily(_:)`](/documentation/AppKit/NSFontDescriptor/withFamily(_:))

Returns a new font descriptor based on the current object, but with the specified font family.

[`withMatrix(_:)`](/documentation/AppKit/NSFontDescriptor/withMatrix(_:))

Returns a new font descriptor based on the current object, but with the specified font matrix.

[`withSize(_:)`](/documentation/AppKit/NSFontDescriptor/withSize(_:))

Returns a new font descriptor based on the current object, but with the specified point size.

[`withSymbolicTraits(_:)`](/documentation/AppKit/NSFontDescriptor/withSymbolicTraits(_:))

Returns a new font descriptor based on the current object, but with the specified symbolic traits taking precedence over the existing ones.

[`withDesign(_:)`](/documentation/AppKit/NSFontDescriptor/withDesign(_:))

Returns a new font descriptor based on the current object, but with the specified design style.

[`NSFontDescriptor.SystemDesign`](/documentation/AppKit/NSFontDescriptor/SystemDesign)

Constants for font designs, such as monospace, rounded, and serif.

### Finding Fonts

[`matchingFontDescriptors(withMandatoryKeys:)`](/documentation/AppKit/NSFontDescriptor/matchingFontDescriptors(withMandatoryKeys:))

Returns all the fonts available on the system whose specified attributes match those of the receiver.

[`matchingFontDescriptor(withMandatoryKeys:)`](/documentation/AppKit/NSFontDescriptor/matchingFontDescriptor(withMandatoryKeys:))

Returns a normalized font descriptor whose specified attributes match those of the receiver.

### Getting the Font Attributes

[`fontAttributes`](/documentation/AppKit/NSFontDescriptor/fontAttributes)

The receiver’s dictionary of attributes.

[`object(forKey:)`](/documentation/AppKit/NSFontDescriptor/object(forKey:))

Returns the font attribute specified by the given key.

[`NSFontDescriptor.AttributeName`](/documentation/AppKit/NSFontDescriptor/AttributeName)

Constants for the names of font attributes.

[`NSFontDescriptor.SymbolicTraits`](/documentation/AppKit/NSFontDescriptor/SymbolicTraits-swift.struct)

A symbolic description of the stylistic aspects of a font.

[`matrix`](/documentation/AppKit/NSFontDescriptor/matrix)

The current transform matrix of the receiver.

[`pointSize`](/documentation/AppKit/NSFontDescriptor/pointSize)

The point size of the receiver.

[`postscriptName`](/documentation/AppKit/NSFontDescriptor/postscriptName)

The PostScript name of the receiver.

[`NSFontDescriptor.FeatureKey`](/documentation/AppKit/NSFontDescriptor/FeatureKey)

Constants to use as keys to retrieve information about a font descriptor from its feature dictionary.

[`NSFontFamilyClass`](/documentation/AppKit/NSFontFamilyClass)

Constants that classify certain stylistic qualities of the font.

[`NSFontFamilyClassMask`](/documentation/AppKit/NSFontFamilyClassMask)

Constant you use to access `NSFontFamilyClass` values in the upper four bits of `NSFontSymbolicTraits`.

[Typeface Information](/documentation/AppKit/typeface-information)

Constants for type faces such as italic or bold.

[`NSFontDescriptor.VariationKey`](/documentation/AppKit/NSFontDescriptor/VariationKey)

Constants that can be used as keys to retrieve information about a font descriptor from its variation axis dictionary.

### Getting the Font Traits

[`symbolicTraits`](/documentation/AppKit/NSFontDescriptor/symbolicTraits-swift.property)

A bit mask that describes the traits of the receiver.

[`NSFontSymbolicTraits`](/documentation/AppKit/NSFontSymbolicTraits)

A symbolic description of stylistic aspects of a font.

[`NSFontDescriptor.TraitKey`](/documentation/AppKit/NSFontDescriptor/TraitKey)

Constants that can be used as keys to retrieve information about a font descriptor from its trait dictionary.

### Requiring Font Assets

[`requiresFontAssetRequest`](/documentation/AppKit/NSFontDescriptor/requiresFontAssetRequest)



---

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)