| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.0 and later. |
| Companion guide | |
| Declared in | NSFontPanel.h |
| Related sample code |
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.
Returns the single NSFontPanel instance for the application, creating it if necessary.
+ (NSFontPanel *)sharedFontPanel
The NSFontPanel instance for the application.
+ sharedFontPanelExists+ setFontPanelFactory: (NSFontManager)NSFontPanel.hReturns YES if the shared Font panel has been created, NO if it hasn’t.
+ (BOOL)sharedFontPanelExists
NSFontPanel.hReturns the receiver’s accessory view.
- (NSView *)accessoryView
NSFontPanel.hIndicates whether the receiver’s Set button is enabled.
- (BOOL)isEnabled
YES if the receiver’s Set button is enabled; NO if it isn’t.
The receiver continues to reflect the font of the selection for cooperating text objects regardless of this setting.
NSFontPanel.h
Converts the specified font using the settings in the receiver, with the aid of the shared NSFontManager if necessary.
- (NSFont *)panelConvertFont:(NSFont *)aFont
The font to be converted.
The converted font, or aFont itself if it can’t be converted.
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.
– convertFont: (NSFontManager)NSFontPanel.hTriggers a reload to the default state, so that the delegate is called.
- (void)reloadDefaultFontFamilies
This reloading provides the delegate opportunity to scrutinize the default list of fonts to be displayed in the panel.
NSFontPanel.hEstablishes 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.
- (void)setAccessoryView:(NSView *)aView
The view to set.
NSFontPanel.h
Specifies whether the receiver’s Set button is enabled.
- (void)setEnabled:(BOOL)flag
If YES the Set button is enabled; if NO, it’s disabled.
The receiver continues to reflect the font of the selection for cooperating text objects regardless of this setting.
NSFontPanel.hSets the selected font in the receiver to the specified font.
- (void)setPanelFont:(NSFont *)aFont isMultiple:(BOOL)flag
The font to be selected.
If NO, selects the specified font; otherwise selects no font and displays a message in the preview area indicating that multiple fonts are selected.
You normally don’t use this method directly; instead, you send setSelectedFont:isMultiple: to the shared NSFontManager, which in turn invokes this method.
NSFontPanel.h
Indicates whether the receiver allows fonts to be changed in modal windows and panels.
- (BOOL)worksWhenModal
YES, regardless of the setting established using the NSPanel method setWorksWhenModal:.
– worksWhenModal (NSWindow)– worksWhenModal (NSPanel)NSFontPanel.hThese 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
};
NSFPPreviewButtonShow the Preview button.
Available in Mac OS X v10.0 and later.
Declared in NSFontPanel.h.
NSFPRevertButtonShow the Revert button.
Available in Mac OS X v10.0 and later.
Declared in NSFontPanel.h.
NSFPSetButtonShow the Set button.
Available in Mac OS X v10.0 and later.
Declared in NSFontPanel.h.
NSFPPreviewFieldShow the Preview field.
Available in Mac OS X v10.0 and later.
Declared in NSFontPanel.h.
NSFPSizeFieldShow the Size field.
Available in Mac OS X v10.0 and later.
Declared in NSFontPanel.h.
NSFPSizeTitleShow the Size title.
Available in Mac OS X v10.0 and later.
Declared in NSFontPanel.h.
NSFPCurrentFieldShow the Current field.
Available in Mac OS X v10.0 and later.
Declared in NSFontPanel.h.
Last updated: 2009-07-24