< Previous PageNext Page > Hide TOC

The Font Panel

The Font panel, also called the Fonts window, is a user interface object that displays a list of available font families and styles, letting the user preview them and change the font used to display text. Text objects, such as NSTextView, work with NSFontPanel and NSFontManager objects to implement the Application Kit’s font conversion system. By default, a text object keeps the Font panel updated with the first font in its selection, or with its typing attributes. It also changes the font in which it displays text in response to messages from the Font panel and Font menu. Such changes apply to the selected text or typing attributes for a rich text object or to all the text in a plain text object.

NSFontManager is the hub for font conversion. It receives the messages from the Font panel and sends messages up the responder chain for action on the text objects.

Normally, an application’s Font panel displays all the standard fonts available on the system. If this isn’t appropriate for your application—for example, if only fixed-pitch fonts should be used—you can assign a delegate to the NSFontPanel object to filter the available fonts. Before the NSFontPanel object adds a particular font family or face to its list, the NSFontPanel asks its delegate to confirm the addition by sending the delegate a fontManager:willIncludeFont: message. If the delegate returns true (or doesn’t implement this method), the font is added. If the delegate returns false, the font isn’t added. This method must be invoked before the loading of the main nib file.



< Previous PageNext Page > Hide TOC


© 1997, 2004 Apple Computer, Inc. All Rights Reserved. (Last updated: 2004-08-31)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.