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

# convert(_:)

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

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

## Parameters

`fontObj`

The font to convert.

## Return Value

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

## Discussion

This method is invoked in response to an action message such as [`addFontTrait(_:)`](/documentation/AppKit/NSFontManager/addFontTrait(_:)) or [`modifyFontViaPanel(_:)`](/documentation/AppKit/NSFontManager/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

[`convert(_:toFamily:)`](/documentation/AppKit/NSFontManager/convert(_:toFamily:))

Returns a font whose traits are as similar as possible to those of the given font except for the font family, which is changed to the given family.

[`convert(_:toSize:)`](/documentation/AppKit/NSFontManager/convert(_:toSize:))

Returns a font object whose traits are the same as those of the given font, except for the size, which is changed to the given size.

[`convert(_:toHaveTrait:)`](/documentation/AppKit/NSFontManager/convert(_:toHaveTrait:))

Returns a new version of the font object containing a single additional trait.

[`convert(_:toNotHaveTrait:)`](/documentation/AppKit/NSFontManager/convert(_:toNotHaveTrait:))

Returns a new version of a font object without the specified traits.

[`convertWeight(_:of:)`](/documentation/AppKit/NSFontManager/convertWeight(_:of:))

Returns a font object whose weight is greater or lesser than that of the given font.

[`convert(_:toFace:)`](/documentation/AppKit/NSFontManager/convert(_:toFace:))

Returns a font whose traits are as similar as possible to those of the given font except for the typeface, which is changed to the given typeface.



---

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)