<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.11.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSLayoutManager/substituteFont(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSLayoutManager(im)substituteFontForFont:"
  },
  "title" : "substituteFont(for:)"
}
-->

# substituteFont(for:)

Replaces the specified font with a suitable screen font if one is available.

```
func substituteFont(for originalFont: NSFont) -> NSFont
```

## Parameters

`originalFont`

The font to replace.

## Return Value

A screen font suitable for use in place of `originalFont`, or simply `originalFont` if a screen font can’t be used or isn’t available.

## Discussion

A screen font can be substituted if the receiver is set to use screen fonts and if no `NSTextView` associated with the receiver is scaled or rotated.

---

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)