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

# convert(_:toHaveTrait:)

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

```
func convert(_ fontObj: NSFont, toHaveTrait trait: NSFontTraitMask) -> NSFont
```

## Parameters

`fontObj`

The font whose traits are matched.

`trait`

The new trait; may be any one of the traits described in `Constants`. Using `NSUnboldFontMask` or `NSUnitalicFontMask` removes the bold or italic trait, respectively.

## Return Value

A font with matching traits including the given trait, or `aFont` if it can’t be converted.

## Discussion

Using `NSUnboldFontMask` or `NSUnitalicFontMask` removes the bold or italic trait, respectively.

## See Also

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

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



---

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)