NSFontManager
The center of activity for the font-conversion system.
Declaration
class NSFontManagerOverview
The font manager records the currently selected font, updates the Font panel and Font menu to reflect the selected font, initiates font changes, and converts fonts in response to requests from text-bearing objects. In a more prosaic role, NSFontManager can be queried for the fonts available to the application and for the particular attributes of a font, such as whether it’s condensed or extended.
You typically set up a font manager and the Font menu using Interface Builder. However, you can also do so programmatically by getting the shared font manager instance and having it create the standard Font menu at runtime:
NSFontManager *fontManager = [NSFontManager sharedFontManager];
NSMenu *fontMenu = [fontManager fontMenu:YES];You can then add the Font menu to your app’s main menu. After the Font menu is installed, your app automatically gains the functionality of both the Font menu and the Font panel.
Font collections are managed by NSFontManager.
Topics
Getting the Shared Font Manager
Changing the Default Font Conversion Classes
Getting Available Fonts
Setting and Examining the Selected Font
Sending Action Methods
addFontTrait(_:)removeFontTrait(_:)modifyFont(_:)modifyFontViaPanel(_:)orderFrontStylesPanel(_:)orderFrontFontPanel(_:)NSFontAction
Converting Fonts Automatically
Converting Fonts Manually
convert(_:toFace:)convert(_:toFamily:)convert(_:toHaveTrait:)convert(_:toNotHaveTrait:)convert(_:toSize:)convertWeight(_:of:)currentFontActionconvertFontTraits(_:)