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

# convertWeight(_:of:)

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

## Declaration

```swift
func convertWeight(_ upFlag: Bool, of fontObj: NSFont) -> NSFont
```

## Parameters

- `upFlag`: If doc://com.apple.documentation/documentation/Swift/true, a heavier font is returned; if it’s doc://com.apple.documentation/documentation/Swift/false, a lighter font is returned.
- `fontObj`: The font whose weight is increased or decreased.

## Return Value

Return Value A font with matching traits except for the new weight, or aFont if it can’t be converted.

## Discussion

Discussion Weights are graded along the following scale. The list on the left gives Apple’s terminology, and the list on the right gives the ISO equivalents. Names on the same line are treated as identical:  |   |   |   |   |   |   |   |   |   |   |   |   |   |   |  The NSFontManager implementation of this method refuses to convert a font’s weight if it can’t maintain all other traits, such as italic and condensed. You might wish to override this method to allow a looser interpretation of weight conversion.

## See Also

### Related Documentation

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

### Converting Fonts Manually

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