Creating a Font Panel

In general, you add the facilities of the font panel to your application, along with the NSFontManager and the Font menu, through which the user opens the font panel, using Interface Builder. You do this by dragging a Font or Format menu (which contains a Font submenu) into one of your application’s menus. At runtime, the font panel object is created and hooked into the font conversion system. You can also create (or access) the font panel using the sharedFontPanel class method.

You can add a custom view object to an NSFontPanel using setAccessoryView, allowing you to add custom controls to the font panel. You can also limit the fonts displayed (by default, all fonts) by assigning a delegate to the application’s font manager object (see The Font Panel).

In Objective-C, if you want the NSFontManager to instantiate the font panel from some class other than NSFontPanel, use the NSFontManager class method setFontPanelFactory:. See Converting Fonts Manually for more information on using the font conversion system.