Retired Document
Important: This document has been retired. For information on the font panel, see The Font Panel in Cocoa Text Architecture Guide.
The Font Panel
The font panel 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.
Copyright © 1997, 2013 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2013-04-23