<!--
{
  "availability" : [
    "macOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSFont/preferredFont(forTextStyle:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFont(cm)preferredFontForTextStyle:options:"
  },
  "title" : "preferredFont(forTextStyle:options:)"
}
-->

# preferredFont(forTextStyle:options:)

Returns the font associated with the text style.

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

## Parameters

`style`

The text style for which to return a font. See [`NSFont.TextStyle`](/documentation/AppKit/NSFont/TextStyle) for available values.

`options`

A dictionary you use to further configure the returned font. See [`NSFont.TextStyleOptionKey`](/documentation/AppKit/NSFont/TextStyleOptionKey) for a list of valid keys. Pass an empty dictionary to use the default configuration.

## Return Value

The font associated with the text style.

---

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)