A dictionary of attributes that describe a font.
SDK
- macOS 10.3+
Framework
- App
Kit
Declaration
class NSFontDescriptor : NSObject
Overview
A font descriptor can be used to create or modify an NSFont
object. The system provides a font matching capability, so that you can partially describe a font by creating a font descriptor with, for example, just a family name. You can then find all the available fonts on the system with a matching family name using matching
.
There are several ways to create a new NSFont
object. You can use alloc
and init(font
, font
, init(name:
, or init(name:
. to create a font descriptor based on either your custom attributes dictionary or on a specific font’s name and size. Alternatively you can use one of the font
instance methods (such as with
) to create a modified version of an existing descriptor. The latter methods are useful if you have an existing descriptor and simply want to change one aspect.
All attributes in the attributes dictionary are optional.