NSFontPanel Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in OS X v10.0 and later. |
| Companion guide | |
| Declared in | NSFontPanel.h |
Overview
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.
Tasks
Getting the Font Panel
Enabling Font Changes
Updating the Font Panel
Converting Fonts
Working in Modal Loops
Setting an Accessory View
Class Methods
sharedFontPanel
Returns the single NSFontPanel instance for the application, creating it if necessary.
Return Value
The NSFontPanel instance for the application.
Availability
- Available in OS X v10.0 and later.
See Also
-
+ sharedFontPanelExists -
+ setFontPanelFactory:(NSFontManager)
Declared In
NSFontPanel.hsharedFontPanelExists
Returns YES if the shared Font panel has been created, NO if it hasn’t.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFontPanel.hInstance Methods
accessoryView
Returns the receiver’s accessory view.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFontPanel.hisEnabled
Indicates whether the receiver’s Set button is enabled.
Discussion
The receiver continues to reflect the font of the selection for cooperating text objects regardless of this setting.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFontPanel.hpanelConvertFont:
Converts the specified font using the settings in the receiver, with the aid of the shared NSFontManager if necessary.
Parameters
- aFont
The font to be converted.
Return Value
The converted font, or aFont itself if it can’t be converted.
Discussion
For example, if aFont is Helvetica Oblique 12.0 point and the user has selected the Times font family (and nothing else) in the Font panel, the font returned is Times Italic 12.0 point.
Availability
- Available in OS X v10.0 and later.
See Also
-
– convertFont:(NSFontManager)
Declared In
NSFontPanel.hreloadDefaultFontFamilies
Triggers a reload to the default state, so that the delegate is called.
Discussion
This reloading provides the delegate opportunity to scrutinize the default list of fonts to be displayed in the panel.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFontPanel.hsetAccessoryView:
Establishes 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.
Parameters
- aView
The view to set.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFontPanel.hsetEnabled:
Specifies whether the receiver’s Set button is enabled.
Discussion
The receiver continues to reflect the font of the selection for cooperating text objects regardless of this setting.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSFontPanel.hsetPanelFont:isMultiple:
Sets the selected font in the receiver to the specified font.
Parameters
- aFont
The font to be selected.
- flag
If
NO, selects the specified font; otherwise selects no font and displays a message in the preview area indicating that multiple fonts are selected.
Discussion
You normally don’t use this method directly; instead, you send setSelectedFont:isMultiple: to the shared NSFontManager, which in turn invokes this method.
Availability
- Available in OS X v10.0 and later.
Declared In
NSFontPanel.hworksWhenModal
Indicates whether the receiver allows fonts to be changed in modal windows and panels.
Return Value
YES, regardless of the setting established using the NSPanel method setWorksWhenModal:.
Availability
- Available in OS X v10.0 and later.
See Also
-
– worksWhenModal(NSWindow) -
– worksWhenModal(NSPanel)
Declared In
NSFontPanel.hConstants
Tags of Views in the FontPanel
These constants are obsolete and should not be used. (Deprecated. Use the method and constants described in NSFontPanelValidation Protocol Reference instead.)
enum {
NSFPPreviewButton = 131,
NSFPRevertButton = 130,
NSFPSetButton = 132,
NSFPPreviewField = 128,
NSFPSizeField = 129,
NSFPSizeTitle = 133,
NSFPCurrentField = 134
};
Constants
NSFPPreviewButtonShow the Preview button.
Available in OS X v10.0 and later.
Declared in
NSFontPanel.h.NSFPRevertButtonShow the Revert button.
Available in OS X v10.0 and later.
Declared in
NSFontPanel.h.NSFPSetButtonShow the Set button.
Available in OS X v10.0 and later.
Declared in
NSFontPanel.h.NSFPPreviewFieldShow the Preview field.
Available in OS X v10.0 and later.
Declared in
NSFontPanel.h.NSFPSizeFieldShow the Size field.
Available in OS X v10.0 and later.
Declared in
NSFontPanel.h.NSFPSizeTitleShow the Size title.
Available in OS X v10.0 and later.
Declared in
NSFontPanel.h.NSFPCurrentFieldShow the Current field.
Available in OS X v10.0 and later.
Declared in
NSFontPanel.h.
© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-07-24)