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

# convert(_:)

Converts the given font according to the object that initiated a font change, typically the Font panel or Font menu.

## Declaration

```swift
func convert(_ fontObj: NSFont) -> NSFont
```

## Parameters

- `fontObj`: The font to convert.

## Return Value

Return Value The converted font, or aFont itself if the conversion isn’t possible.

## Discussion

Discussion This method is invoked in response to an action message such as addFontTrait(_:) or modifyFontViaPanel(_:). These initiating methods cause the font manager to query the sender for the action to take and the traits to change. See Converting Fonts Manually for more information.

## See Also

### Related Documentation

- [convert(_:toFamily:)](appkit/nsfontmanager/convert(_:tofamily:).md)
- [convert(_:toSize:)](appkit/nsfontmanager/convert(_:tosize:).md)
- [convert(_:toHaveTrait:)](appkit/nsfontmanager/convert(_:tohavetrait:).md)
- [convert(_:toNotHaveTrait:)](appkit/nsfontmanager/convert(_:tonothavetrait:).md)
- [convertWeight(_:of:)](appkit/nsfontmanager/convertweight(_:of:).md)
- [convert(_:toFace:)](appkit/nsfontmanager/convert(_:toface:).md)
