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

# addFontTrait(_:)

Adds a trait to the font.

```
func addFontTrait(_ sender: Any?)
```

## Parameters

`sender`

The control that sent the message.

## Discussion

By default, the action message is <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/changeFont:>. This action method causes the receiver to send its action message up the responder chain.

When a responder replies by providing a font to convert in a [`convert(_:)`](/documentation/AppKit/NSFontManager/convert(_:)) message, the receiver converts the font by adding the trait specified by `sender`. This trait is determined by sending a `tag` message to `sender` and interpreting it as a font trait mask for a [`convert(_:toHaveTrait:)`](/documentation/AppKit/NSFontManager/convert(_:toHaveTrait:)) message.

---

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)