Up

# NSFont

### Authors

Ovidiu Predescu (`ovidiu@net-community.com`)

> The font class

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

### Contents -

1. NSFont
2. Software documentation for the NSFont(GNUstep) category

# NSFont

The NSFont class allows control of the fonts used for displaying text anywhere on the screen. The primary methods for getting a particular font are +fontWithName:matrix: and +fontWithName:size: which take the name and size of a particular font and return the NSFont object associated with that font. In addition there are several convenience mathods which make it easier to get certain types of fonts.

In particular, there are several methods to get the standard fonts used by the Application to display text for a partiuclar purpose. See the class methods listed below for more information. These default fonts can be set using the user defaults system. The default font names available are:

- NSBoldFont Helvetica-Bold (System bold font)
- NSControlContentFont System font
- NSFont Helvetica (System Font)
- NSLabelFont System font
- NSMenuFont System font
- NSMessageFont System font
- NSPaletteFont System bold font
- NSTitleBarFont System bold font
- NSToolTipsFont System font
- NSUserFixedPitchFont Courier
- NSUserFont System font

The default sizes are:

- NSBoldFontSize (none)
- NSControlContentFontSize (none)
- NSFontSize 12 (System Font Size)
- NSLabelFontSize (none)
- NSMenuFontSize (none)
- NSMessageFontSize (none)
- NSPaletteFontSize (none)
- NSSmallFontSize 9
- NSTitleBarFontSize (none)
- NSToolTipsFontSize (none)
- NSUserFixedPitchFontSize (none)
- NSUserFontSize (none)

Font sizes list with (none) default to NSFontSize.

## NSFont : NSObject

> Declared in:
>   AppKit/NSFont.h

> Conforms to:
>   NSCoding
>   NSCopying

> Standards:
> - MacOS-X
> - OpenStep
> - GNUstep

Description forthcoming.

Method summary

- -fontInfo
- -fontRef
- +boldSystemFontOfSize:
- +controlContentFontOfSize:
- +fontWithName:matrix:
- +fontWithName:size:
- +labelFontOfSize:
- +labelFontSize
- +menuFontOfSize:
- +messageFontOfSize:
- +paletteFontOfSize:
- +preferredFontNames
- +setPreferredFontNames:
- +setUserFixedPitchFont:
- +setUserFont:
- +smallSystemFontSize
- +systemFontOfSize:
- +systemFontSize
- +titleBarFontOfSize:
- +toolTipsFontOfSize:
- +useFont:
- +userFixedPitchFontOfSize:
- +userFontOfSize:
- -advancementForGlyph:
- -afmDictionary
- -afmFileContents
- -ascender
- -boundingRectForFont
- -boundingRectForGlyph:
- -capHeight
- -defaultLineHeightForFont
- -descender
- -displayName
- -encodingScheme
- -familyName
- -fontName
- -glyphIsEncoded:
- -glyphPacking
- -glyphWithName:
- -isBaseFont
- -isFixedPitch
- -italicAngle
- -matrix
- -maximumAdvancement
- -minimumAdvancement
- -mostCompatibleStringEncoding
- -pointSize
- -positionOfGlyph:forCharacter:struckOverRect:
- -positionOfGlyph:precededByGlyph:isNominal:
- -positionOfGlyph:struckOverGlyph:metricsExist:
- -positionOfGlyph:struckOverRect:metricsExist:
- -positionOfGlyph:withRelation:toBaseGlyph:totalAdvancement:metricsExist:
- -positionsForCompositeSequence:numberOfGlyphs:pointArray:
- -printerFont
- -screenFont
- -set
- -underlinePosition
- -underlineThickness
- -widthOfString:
- -xHeight

### boldSystemFontOfSize:

+ (NSFont*) boldSystemFontOfSize: (float)fontSize;

Return the default bold font for use in menus and heading in standard gui components.
This is deprecated in MacOSX

### controlContentFontOfSize:

+ (NSFont*) controlContentFontOfSize: (float)fontSize;

Description forthcoming.

### fontWithName:matrix:

+ (NSFont*) fontWithName: (NSString*)aFontName matrix: (const float*)fontMatrix;

Returns an autoreleased font with name aFontName and matrix fontMatrix .
The fontMatrix is a standard size element matrix as used in PostScript to describe the scaling of the font, typically it just includes the font size as [fontSize 0 0 fontSize 0 0]. You can use the constant NSFontIdentityMatrix in place of [1 0 0 1 0 0]. If NSFontIdentityMatrix, then the font will automatically flip itself when set in a flipped view.

### fontWithName:size:

+ (NSFont*) fontWithName: (NSString*)aFontName size: (float)fontSize;

Returns an autoreleased font with name aFontName and size fontSize.
Fonts created using this method will automatically flip themselves when set in a flipped view.

### labelFontOfSize:

+ (NSFont*) labelFontOfSize: (float)fontSize;

Description forthcoming.

### labelFontSize

+ (float) labelFontSize;

Description forthcoming.

### menuFontOfSize:

+ (NSFont*) menuFontOfSize: (float)fontSize;

Description forthcoming.

### messageFontOfSize:

+ (NSFont*) messageFontOfSize: (float)fontSize;

Description forthcoming.

### paletteFontOfSize:

+ (NSFont*) paletteFontOfSize: (float)fontSize;

Description forthcoming.

### preferredFontNames

+ (NSArray*) preferredFontNames;

Return an array of the names of preferred fonts.

### setPreferredFontNames:

+ (void) setPreferredFontNames: (NSArray*)fontNames;

Description forthcoming.

### setUserFixedPitchFont:

+ (void) setUserFixedPitchFont: (NSFont*)aFont;

Description forthcoming.

### setUserFont:

+ (void) setUserFont: (NSFont*)aFont;

Description forthcoming.

### smallSystemFontSize

+ (float) smallSystemFontSize;

Description forthcoming.

### systemFontOfSize:

+ (NSFont*) systemFontOfSize: (float)fontSize;

Return the default font for use in menus and heading in standard gui components.
This is deprecated in MacOSX

### systemFontSize

+ (float) systemFontSize;

Description forthcoming.

### titleBarFontOfSize:

+ (NSFont*) titleBarFontOfSize: (float)fontSize;

Description forthcoming.

### toolTipsFontOfSize:

+ (NSFont*) toolTipsFontOfSize: (float)fontSize;

Description forthcoming.

### useFont:

+ (void) useFont: (NSString*)aFontName;

Description forthcoming.

### userFixedPitchFontOfSize:

+ (NSFont*) userFixedPitchFontOfSize: (float)fontSize;

Return the default fixed pitch font for use in locations other than standard gui components.

### userFontOfSize:

+ (NSFont*) userFontOfSize: (float)fontSize;

Return the default font for use in locations other than standard gui components.

### advancementForGlyph:

- (NSSize) advancementForGlyph: (NSGlyph)aGlyph;

Description forthcoming.

### afmDictionary

- (NSDictionary*) afmDictionary;

Description forthcoming.

### afmFileContents

- (NSString*) afmFileContents;

Description forthcoming.

### ascender

- (float) ascender;

Description forthcoming.

### boundingRectForFont

- (NSRect) boundingRectForFont;

Description forthcoming.

### boundingRectForGlyph:

- (NSRect) boundingRectForGlyph: (NSGlyph)aGlyph;

Description forthcoming.

### capHeight

- (float) capHeight;

Description forthcoming.

### defaultLineHeightForFont

- (float) defaultLineHeightForFont;

Description forthcoming.

### descender

- (float) descender;

Description forthcoming.

### displayName

- (NSString*) displayName;

Description forthcoming.

### encodingScheme

- (NSString*) encodingScheme;

Description forthcoming.

### familyName

- (NSString*) familyName;

Description forthcoming.

### fontName

- (NSString*) fontName;

Description forthcoming.

### glyphIsEncoded:

- (BOOL) glyphIsEncoded: (NSGlyph)aGlyph;

Description forthcoming.

### glyphPacking

- (NSMultibyteGlyphPacking) glyphPacking;

Description forthcoming.

### glyphWithName:

- (NSGlyph) glyphWithName: (NSString*)glyphName;

Description forthcoming.

### isBaseFont

- (BOOL) isBaseFont;

Description forthcoming.

### isFixedPitch

- (BOOL) isFixedPitch;

Description forthcoming.

### italicAngle

- (float) italicAngle;

Description forthcoming.

### matrix

- (const float*) matrix;

Description forthcoming.

### maximumAdvancement

- (NSSize) maximumAdvancement;

Description forthcoming.

### minimumAdvancement

- (NSSize) minimumAdvancement;

Description forthcoming.

### mostCompatibleStringEncoding

- (NSStringEncoding) mostCompatibleStringEncoding;

Description forthcoming.

### pointSize

- (float) pointSize;

Description forthcoming.

### positionOfGlyph:forCharacter:struckOverRect:

- (NSPoint) positionOfGlyph: (NSGlyph)aGlyph forCharacter: (unichar)aChar struckOverRect: (NSRect)aRect;

Description forthcoming.

### positionOfGlyph:precededByGlyph:isNominal:

- (NSPoint) positionOfGlyph: (NSGlyph)curGlyph precededByGlyph: (NSGlyph)prevGlyph isNominal: (BOOL*)nominal;

Description forthcoming.

### positionOfGlyph:struckOverGlyph:metricsExist:

- (NSPoint) positionOfGlyph: (NSGlyph)aGlyph struckOverGlyph: (NSGlyph)baseGlyph metricsExist: (BOOL*)flag;

Description forthcoming.

### positionOfGlyph:struckOverRect:metricsExist:

- (NSPoint) positionOfGlyph: (NSGlyph)aGlyph struckOverRect: (NSRect)aRect metricsExist: (BOOL*)flag;

Description forthcoming.

### positionOfGlyph:withRelation:toBaseGlyph:totalAdvancement:metricsExist:

- (NSPoint) positionOfGlyph: (NSGlyph)aGlyph withRelation: (NSGlyphRelation)relation toBaseGlyph: (NSGlyph)baseGlyph totalAdvancement: (NSSize*)offset metricsExist: (BOOL*)flag;

Description forthcoming.

### positionsForCompositeSequence:numberOfGlyphs:pointArray:

- (int) positionsForCompositeSequence: (NSGlyph*)glyphs numberOfGlyphs: (int)numGlyphs pointArray: (NSPoint*)points;

Description forthcoming.

### printerFont

- (NSFont*) printerFont;

Description forthcoming.

### screenFont

- (NSFont*) screenFont;

Description forthcoming.

### set

- (void) set;

Sets the receiver as the font used for text drawing operations. If the current view is a flipped view, the reciever automatically flips itself to display correctly in the flipped view, as long as the font was created without explicitly setting the font matrix

### underlinePosition

- (float) underlinePosition;

Description forthcoming.

### underlineThickness

- (float) underlineThickness;

Description forthcoming.

### widthOfString:

- (float) widthOfString: (NSString*)string;

Description forthcoming.

### xHeight

- (float) xHeight;

Description forthcoming.

# Software documentation for the NSFont(GNUstep) category

## NSFont(GNUstep)

> Declared in:
>   AppKit/NSFont.h

> Standards:
> - MacOS-X
> - NotOpenStep
> - GNUstep

Description forthcoming.

Method summary

- -fontInfo
- -fontRef

### fontInfo

- (GSFontInfo*) fontInfo;

Description forthcoming.

### fontRef

- (void*) fontRef;

Description forthcoming.

Up