---
title: "preferredFontDescriptor(forTextStyle:options:)"
framework: appkit
role: symbol
role_heading: Type Method
path: "appkit/nsfontdescriptor/preferredfontdescriptor(fortextstyle:options:)"
---

# preferredFontDescriptor(forTextStyle:options:)

Returns a font descriptor that contains the text style.

## Declaration

```swift
class func preferredFontDescriptor(forTextStyle style: NSFont.TextStyle, options: [NSFont.TextStyleOptionKey : Any] = [:]) -> NSFontDescriptor
```

## Parameters

- `style`: The text style for which to return a font descriptor. See doc://com.apple.appkit/documentation/AppKit/NSFont/TextStyle for available values.
- `options`: A dictionary you use to further configure the returned font descriptor. See doc://com.apple.appkit/documentation/AppKit/NSFont/TextStyleOptionKey for a list of valid keys. Pass an empty dictionary to use the default configuration.

## Return Value

Return Value The font descriptor that contains the text style.

## Discussion

Discussion The font descriptor contains a dictionary of attributes that you use to create an NSFont object. See NSFontDescriptor for more information.

## See Also

### Creating a Font Descriptor

- [init(name:matrix:)](appkit/nsfontdescriptor/init(name:matrix:).md)
- [init(name:size:)](appkit/nsfontdescriptor/init(name:size:).md)
- [init(fontAttributes:)](appkit/nsfontdescriptor/init(fontattributes:).md)
