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.h
Returns YES
if the shared Font panel has been created, NO
if it hasn’t.
+ (BOOL)sharedFontPanelExists
NSFontPanel.h
Returns the receiver’s accessory view.
- (NSView *)accessoryView
NSFontPanel.h
Indicates 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.h
Triggers 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.h
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.
- (void)setAccessoryView:(NSView *)aView
The view to set.
NSFontPanel.h
Specifies whether the receiver’s Set button is enabled.
- (void)setEnabled:(BOOL)flag
The receiver continues to reflect the font of the selection for cooperating text objects regardless of this setting.
NSFontPanel.h
Sets 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.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-04-06)