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

# 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.

## Declaration

```swift
func convert(_ fontObj: NSFont, toFamily family: String) -> NSFont
```

## Parameters

- `fontObj`: The font whose traits are matched.
- `family`: The new font family; a generic font name, such as Helvetica or Times.

## Return Value

Return Value A font with matching traits and the given family, or aFont if it can’t be converted.

## Discussion

Discussion This method attempts to match the weight and posture of aFont as closely as possible. Italic is mapped to Oblique, for example. Weights are mapped based on an approximate numeric scale of 0 to 15.

## See Also

### Related Documentation

- [convert(_:)](appkit/nsfontmanager/convert(_:).md)

### Converting Fonts Manually

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