availableFontNames(with:)
Returns the names of the fonts available in the system whose traits are described exactly by the given font trait mask (not the NSFont objects themselves).
Declaration
func availableFontNames(with someTraits: NSFontTraitMask) -> [String]?Parameters
- someTraits:
The font traits for which to return font names. You specify the desired traits by combining the font trait mask values described in
Constantsusing the C bitwise OR operator.
Return Value
The names of the corresponding fonts.
Discussion
These fonts are in various system font directories.
If someTraits is 0, this method returns all fonts that are neither italic nor bold. This result is the same one you’d get if fontTraitMask were NSUnitalicFontMask | NSUnboldFontMask.