---
title: "fontNamed(_:hasTraits:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsfontmanager/fontnamed(_:hastraits:)"
---

# fontNamed(_:hasTraits:)

Indicates whether the given font has all the specified traits.

## Declaration

```swift
func fontNamed(_ fName: String, hasTraits someTraits: NSFontTraitMask) -> Bool
```

## Parameters

- `fName`: The name of the font.
- `someTraits`: The font traits to test, specified by combining the font trait mask values described in Constants using the C bitwise OR operator.

## Return Value

Return Value true if the font named typeface has all the traits specified in fontTraitMask; false if it doesn’t.

## Discussion

Discussion Using NSUnboldFontMask returns true if the font is not bold, false otherwise. Using NSUnitalicFontMask returns true if the font is not italic, false otherwise.

## See Also

### Examining Fonts

- [traits(of:)](appkit/nsfontmanager/traits(of:).md)
- [NSFontTraitMask](appkit/nsfonttraitmask.md)
- [weight(of:)](appkit/nsfontmanager/weight(of:).md)
