Up

# NSFontManager

### Authors

Fred Kiefer (`FredKiefer@gmx.de`)

> Manages system and user fonts

Copyright: (C) 1996 Free Software Foundation, Inc.

### Contents -

1. Software documentation for the NSFontManager class
2. Software documentation for the NSObject(NSFontManagerDelegate) informal protocol

# Software documentation for the NSFontManager class

## NSFontManager : NSObject

> Declared in:
>   AppKit/NSFontManager.h

Availability: OpenStep
Description forthcoming.

Instance Variables
Method summary

- +setFontManagerFactory:
- +setFontPanelFactory:
- +sharedFontManager
- -action
- -addCollection:options:
- -addFontDescriptors:toCollection:
- -addFontTrait:
- -availableFontFamilies
- -availableFontNamesMatchingFontDescriptor:
- -availableFontNamesWithTraits:
- -availableFonts
- -availableMembersOfFontFamily:
- -collectionNames
- -convertAttributes:
- -convertFont:
- -convertFont:toFace:
- -convertFont:toFamily:
- -convertFont:toHaveTrait:
- -convertFont:toNotHaveTrait:
- -convertFont:toSize:
- -convertWeight:ofFont:
- -delegate
- -fontDescriptorsInCollection:
- -fontMenu:
- -fontNamed:hasTraits:
- -fontPanel:
- -fontWithFamily:traits:weight:size:
- -isEnabled
- -isMultiple
- -localizedNameForFamily:face:
- -modifyFont:
- -modifyFontViaPanel:
- -orderFrontFontPanel:
- -removeCollection:
- -removeFontDescriptor:fromCollection:
- -removeFontTrait:
- -selectedFont
- -sendAction
- -setAction:
- -setDelegate:
- -setEnabled:
- -setFontMenu:
- -setSelectedAttributes:isMultiple:
- -setSelectedFont:isMultiple:
- -traitsOfFont:
- -weightOfFont:

### setFontManagerFactory:

+ (void) setFontManagerFactory: (Class)aClass;
Availability: OpenStep

Sets the class used to create the NSFontManager to aClass. By default it is a NSFontManager class. You can change this behavour by implementing your own class (a subclass of NSFontManager)

This class is init into +sharedFontManager

See Also: +sharedFontManager

### setFontPanelFactory:

+ (void) setFontPanelFactory: (Class)aClass;
Availability: OpenStep

Sets the class used to create a NSFontPanel. If you want to use a custom class it should be NSFontPanel subclass

See Also: -fontPanel:

### sharedFontManager

+ (NSFontManager*) sharedFontManager;
Availability: OpenStep

Creates (if needed) and returns the NSFontManager shared instance. This method init the font manager class defined in +setFontManagerFactory: (it is usally a NSFontManager class)

### action

- (SEL) action;
Availability: OpenStep

Returns the action sents by the NSFontManager.

See Also: -setAction:

### addCollection: options:

- (BOOL) addCollection: (NSString*)name options: (int)options;
Availability: MacOS-X 10.3.0
Description forthcoming.

### addFontDescriptors: toCollection:

- (void) addFontDescriptors: (NSArray*)descriptors toCollection: (NSString*)collection;
Availability: MacOS-X 10.3.0
Description forthcoming.

### addFontTrait:

- (void) addFontTrait: (id)sender;
Availability: OpenStep
Description forthcoming.

### availableFontFamilies

- (NSArray*) availableFontFamilies;
Availability: OpenStep
Description forthcoming.

### availableFontNamesMatchingFontDescriptor:

- (NSArray*) availableFontNamesMatchingFontDescriptor: (NSFontDescriptor*)descriptor;
Availability: MacOS-X 10.3.0
Description forthcoming.

### availableFontNamesWithTraits:

- (NSArray*) availableFontNamesWithTraits: (NSFontTraitMask)fontTraitMask;
Availability: OpenStep
Description forthcoming.

### availableFonts

- (NSArray*) availableFonts;
Availability: OpenStep

Returns an array of available fonts.

### availableMembersOfFontFamily:

- (NSArray*) availableMembersOfFontFamily: (NSString*)family;
Availability: OpenStep
Description forthcoming.

### collectionNames

- (NSArray*) collectionNames;
Availability: MacOS-X 10.3.0
Description forthcoming.

### convertAttributes:

- (NSDictionary*) convertAttributes: (NSDictionary*)attributes;
Availability: MacOS-X 10.3.0
Description forthcoming.

### convertFont:

- (NSFont*) convertFont: (NSFont*)fontObject;
Availability: OpenStep

Converts the NSFont fontObject according to user changes in the Font panel or the font menu

See Also: -addFontTrait: -removeFontTrait: -modifyFont: -modifyFontViaPanel: -convertFont:toHaveTrait: -convertFont:toNotHaveTrait: -convertFont:toSize: -convertFont:toFamily: -convertWeight:ofFont:

### convertFont: toFace:

- (NSFont*) convertFont: (NSFont*)fontObject toFace: (NSString*)typeface;
Availability: OpenStep
Description forthcoming.

### convertFont: toFamily:

- (NSFont*) convertFont: (NSFont*)fontObject toFamily: (NSString*)family;
Availability: OpenStep
Description forthcoming.

### convertFont: toHaveTrait:

- (NSFont*) convertFont: (NSFont*)fontObject toHaveTrait: (NSFontTraitMask)trait;
Availability: OpenStep
Description forthcoming.

### convertFont: toNotHaveTrait:

- (NSFont*) convertFont: (NSFont*)fontObject toNotHaveTrait: (NSFontTraitMask)trait;
Availability: OpenStep
Description forthcoming.

### convertFont: toSize:

- (NSFont*) convertFont: (NSFont*)fontObject toSize: (float)size;
Availability: OpenStep
Description forthcoming.

### convertWeight: ofFont:

- (NSFont*) convertWeight: (BOOL)upFlag ofFont: (NSFont*)fontObject;
Availability: OpenStep
Description forthcoming.

### delegate

- (id) delegate;
Availability: OpenStep

Returns the NSFontManager's delegate

### fontDescriptorsInCollection:

- (NSArray*) fontDescriptorsInCollection: (NSString*)collection;
Availability: MacOS-X 10.3.0
Description forthcoming.

### fontMenu:

- (NSMenu*) fontMenu: (BOOL)create;
Availability: OpenStep

Returns the font menu, creates it (if needed) if create is `YES`.

See Also: -setFontMenu:

### fontNamed: hasTraits:

- (BOOL) fontNamed: (NSString*)typeface hasTraits: (NSFontTraitMask)fontTraitMask;
Availability: OpenStep
Description forthcoming.

### fontPanel:

- (NSFontPanel*) fontPanel: (BOOL)create;
Availability: OpenStep

Returns the NSFontPanel, creates it (if needed) if create is `YES`.

See Also: +setFontPanelFactory:

### fontWithFamily: traits: weight: size:

- (NSFont*) fontWithFamily: (NSString*)family traits: (NSFontTraitMask)traits weight: (int)weight size: (float)size;
Availability: OpenStep
Description forthcoming.

### isEnabled

- (BOOL) isEnabled;
Availability: OpenStep

Returns whether the NSFontPanel is enabled (if exists)

### isMultiple

- (BOOL) isMultiple;
Availability: OpenStep

Returns whether the current selection contains multiple fonts

### localizedNameForFamily: face:

- (NSString*) localizedNameForFamily: (NSString*)family face: (NSString*)face;
Availability: OpenStep
Description forthcoming.

### modifyFont:

- (void) modifyFont: (id)sender;
Availability: OpenStep
Description forthcoming.

### modifyFontViaPanel:

- (void) modifyFontViaPanel: (id)sender;
Availability: OpenStep
Description forthcoming.

### orderFrontFontPanel:

- (void) orderFrontFontPanel: (id)sender;
Availability: OpenStep
Description forthcoming.

### removeCollection:

- (BOOL) removeCollection: (NSString*)collection;
Availability: MacOS-X 10.3.0
Description forthcoming.

### removeFontDescriptor: fromCollection:

- (void) removeFontDescriptor: (NSFontDescriptor*)descriptor fromCollection: (NSString*)collection;
Availability: MacOS-X 10.3.0
Description forthcoming.

### removeFontTrait:

- (void) removeFontTrait: (id)sender;
Availability: OpenStep
Description forthcoming.

### selectedFont

- (NSFont*) selectedFont;
Availability: OpenStep

Returns the selected font

See Also: -setSelectedFont:isMultiple:

### sendAction

- (BOOL) sendAction;
Availability: OpenStep
Description forthcoming.

### setAction:

- (void) setAction: (SEL)aSelector;
Availability: OpenStep

Sents the action sents by the NSFontManager to aSelector.

See Also: -action

### setDelegate:

- (void) setDelegate: (id)anObject;
Availability: OpenStep

Sets the NSFontManager's delegate to anObject

FIXME: This is extremely unclear. At the moment, the NSFontManager's delegate is never used. This can't be right.

### setEnabled:

- (void) setEnabled: (BOOL)flag;
Availability: OpenStep

Enables/disables the NSFontPanel and the font menu (if they exist)

See Also: -isEnabled

### setFontMenu:

- (void) setFontMenu: (NSMenu*)newMenu;
Availability: OpenStep

Sets the font menu to newMenu

See Also: -fontMenu:

### setSelectedAttributes: isMultiple:

- (void) setSelectedAttributes: (NSDictionary*)attributes isMultiple: (BOOL)flag;
Availability: MacOS-X 10.3.0
Description forthcoming.

### setSelectedFont: isMultiple:

- (void) setSelectedFont: (NSFont*)fontObject isMultiple: (BOOL)flag;
Availability: OpenStep
Description forthcoming.

### traitsOfFont:

- (NSFontTraitMask) traitsOfFont: (NSFont*)aFont;
Availability: OpenStep
Description forthcoming.

### weightOfFont:

- (int) weightOfFont: (NSFont*)fontObject;
Availability: OpenStep

Returns the weight of the NSFont fontObject

## Instance Variables for NSFontManager Class

### _action

@protected SEL _action;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _collections

@protected NSMutableDictionary* _collections;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _delegate

@protected id _delegate;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _fontEnumerator

@protected id _fontEnumerator;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _fontMenu

@protected NSMenu* _fontMenu;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _multiple

@protected BOOL _multiple;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _selectedAttributes

@protected NSDictionary* _selectedAttributes;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _selectedFont

@protected NSFont* _selectedFont;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _storedTag

@protected NSFontTag _storedTag;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _trait

@protected NSFontTraitMask _trait;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

# Software documentation for the NSObject(NSFontManagerDelegate) informal protocol

## NSObject(NSFontManagerDelegate)

> Declared in:
>   AppKit/NSFontManager.h

Availability: OpenStep
Description forthcoming.
Method summary

- -fontManager:willIncludeFont:

### fontManager: willIncludeFont:

- (BOOL) fontManager: (id)sender willIncludeFont: (NSString*)fontName;
Availability: OpenStep
Description forthcoming.

Up