---
title: "addFontTrait(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsfontmanager/addfonttrait(_:)"
---

# addFontTrait(_:)

Adds a trait to the font.

## Declaration

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

## Parameters

- `sender`: The control that sent the message.

## Discussion

Discussion By default, the action message is 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(_:) 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:) message.

## See Also

### Sending Action Methods

- [removeFontTrait(_:)](appkit/nsfontmanager/removefonttrait(_:).md)
- [modifyFont(_:)](appkit/nsfontmanager/modifyfont(_:).md)
- [modifyFontViaPanel(_:)](appkit/nsfontmanager/modifyfontviapanel(_:).md)
- [orderFrontStylesPanel(_:)](appkit/nsfontmanager/orderfrontstylespanel(_:).md)
- [orderFrontFontPanel(_:)](appkit/nsfontmanager/orderfrontfontpanel(_:).md)
- [NSFontAction](appkit/nsfontaction.md)
