The NSFontPanel class implements the Font panel—a user interface object that displays a list of available fonts, letting the user preview them and change the font used to display text. The actual changes are made through conversion messages sent to the shared NSFontManager instance. There’s only one Font panel for each application.


Getting the Font Panel

class func shared()

Returns the single NSFontPanel instance for the application, creating it if necessary.

class func sharedFontPanelExists()

Returns true if the shared Font panel has been created, false if it hasn’t.

Enabling Font Changes

var isEnabled: Bool

A boolean that shows whether the receiver’s Set button is enabled.

func reloadDefaultFontFamilies()

Triggers a reload to the default state, so that the delegate is called.

Updating the Font Panel

func setPanelFont(NSFont, isMultiple: Bool)

Sets the selected font in the receiver to the specified font.

Converting Fonts

func convert(NSFont)

Converts the specified font using the settings in the receiver, with the aid of the shared NSFontManager if necessary.

Working in Modal Loops

var worksWhenModal: Bool

A boolean that indicates whether the receiver allows fonts to be changed in modal windows and panels.

Setting an Accessory View

var accessoryView: NSView?

The specified view as the receiver’s accessory view, allowing you to add custom controls to your application’s Font panel without having to create a subclass.


Inherits From