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:

The default sizes are:

Font sizes list with (none) default to NSFontSize.

NSFont : NSObject

Declared in:
AppKit/NSFont.h
Conforms to:
NSCoding
NSCopying
Availability: OpenStep

Description forthcoming.

Instance Variables

Method summary

boldSystemFontOfSize: 

+ (NSFont*) boldSystemFontOfSize: (CGFloat)fontSize;
Availability: OpenStep

Returns the default bold font for use in menus and heading in standard gui components. If fontSize is <= 0, the default size is used.

See Also: +fontWithName:size:


controlContentFontOfSize: 

+ (NSFont*) controlContentFontOfSize: (CGFloat)fontSize;
Availability: MacOS-X 10.0.0

Description forthcoming.

fontWithDescriptor: size: 

+ (NSFont*) fontWithDescriptor: (NSFontDescriptor*)descriptor size: (CGFloat)size;
Availability: Not in OpenStep/MacOS-X

Description forthcoming.

fontWithDescriptor: size: textTransform: 

+ (NSFont*) fontWithDescriptor: (NSFontDescriptor*)descriptor size: (CGFloat)size textTransform: (NSAffineTransform*)transform;
Availability: Not in OpenStep/MacOS-X

Description forthcoming.

fontWithDescriptor: textTransform: 

+ (NSFont*) fontWithDescriptor: (NSFontDescriptor*)descriptor textTransform: (NSAffineTransform*)transform;
Availability: Not in OpenStep/MacOS-X

Description forthcoming.

fontWithName: matrix: 

+ (NSFont*) fontWithName: (NSString*)aFontName matrix: (const CGFloat*)fontMatrix;
Availability: OpenStep

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: (CGFloat)fontSize;
Availability: OpenStep

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: (CGFloat)fontSize;
Availability: MacOS-X 10.0.0

Description forthcoming.

labelFontSize 

+ (CGFloat) labelFontSize;
Availability: MacOS-X 10.0.0

Description forthcoming.

menuBarFontOfSize: 

+ (NSFont*) menuBarFontOfSize: (CGFloat)fontSize;
Availability: MacOS-X 10.0.0

Description forthcoming.

menuFontOfSize: 

+ (NSFont*) menuFontOfSize: (CGFloat)fontSize;
Availability: MacOS-X 10.0.0

Description forthcoming.

messageFontOfSize: 

+ (NSFont*) messageFontOfSize: (CGFloat)fontSize;
Availability: MacOS-X 10.0.0

Description forthcoming.

paletteFontOfSize: 

+ (NSFont*) paletteFontOfSize: (CGFloat)fontSize;
Availability: MacOS-X 10.0.0

Description forthcoming.

preferredFontNames 

+ (NSArray*) preferredFontNames;
Availability: OpenStep

Returns an array of the names of preferred fonts.

See Also: +setPreferredFontNames:


setPreferredFontNames: 

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

Sets an array of the names of preferred fonts to fontsNames/

See Also: +preferredFontNames


setUserFixedPitchFont: 

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

Description forthcoming.

setUserFont: 

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

Description forthcoming.

smallSystemFontSize 

+ (CGFloat) smallSystemFontSize;
Availability: MacOS-X 10.0.0

Description forthcoming.

systemFontOfSize: 

+ (NSFont*) systemFontOfSize: (CGFloat)fontSize;
Availability: OpenStep

Returns the default font for use in menus and heading in standard gui components. If fontSize is <= 0, the default size is used.

See Also: +boldSystemFontOfSize: userFontOfSize: userFixedPitchFontOfSize: +fontWithName:size:


systemFontSize 

+ (CGFloat) systemFontSize;
Availability: MacOS-X 10.0.0

Description forthcoming.

systemFontSizeForControlSize: 

+ (CGFloat) systemFontSizeForControlSize: (NSControlSize)controlSize;
Availability: MacOS-X 10.0.0

Description forthcoming.

titleBarFontOfSize: 

+ (NSFont*) titleBarFontOfSize: (CGFloat)fontSize;
Availability: MacOS-X 10.0.0

Description forthcoming.

toolTipsFontOfSize: 

+ (NSFont*) toolTipsFontOfSize: (CGFloat)fontSize;
Availability: MacOS-X 10.0.0

Description forthcoming.

useFont: 

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

Description forthcoming.

userFixedPitchFontOfSize: 

+ (NSFont*) userFixedPitchFontOfSize: (CGFloat)fontSize;
Availability: OpenStep

Returns the default fixed pitch font for use in locations other than standard gui components. If fontSize is <= 0, the default size is used.

See Also: +setUserFixedPitchFont: +userFontOfSize: +boldSystemFontOfSize: +systemFontOfSize: +fontWithName:size:


userFontOfSize: 

+ (NSFont*) userFontOfSize: (CGFloat)fontSize;
Availability: OpenStep

Returns the default font for use in locations other than standard gui components. If fontSize is <= 0, the default size is used.

See Also: +setUserFont: +boldSystemFontOfSize: systemFontOfSize: userFixedPitchFontOfSize: +fontWithName:size:


advancementForGlyph: 

- (NSSize) advancementForGlyph: (NSGlyph)aGlyph;
Availability: OpenStep

Description forthcoming.

afmDictionary 

- (NSDictionary*) afmDictionary;
Availability: OpenStep

Description forthcoming.

afmFileContents 

- (NSString*) afmFileContents;
Availability: OpenStep

This method returns nil in the GNUstep implementation


ascender 

- (CGFloat) ascender;
Availability: OpenStep

Description forthcoming.

boundingRectForFont 

- (NSRect) boundingRectForFont;
Availability: OpenStep

Description forthcoming.

boundingRectForGlyph: 

- (NSRect) boundingRectForGlyph: (NSGlyph)aGlyph;
Availability: OpenStep

Description forthcoming.

capHeight 

- (CGFloat) capHeight;
Availability: OpenStep

Description forthcoming.

coveredCharacterSet 

- (NSCharacterSet*) coveredCharacterSet;
Availability: MacOS-X 10.0.0

Description forthcoming.

defaultLineHeightForFont 

- (CGFloat) defaultLineHeightForFont;
Availability: OpenStep

Description forthcoming.

descender 

- (CGFloat) descender;
Availability: OpenStep

Description forthcoming.

displayName 

- (NSString*) displayName;
Availability: OpenStep

Description forthcoming.

encodingScheme 

- (NSString*) encodingScheme;
Availability: OpenStep

Description forthcoming.

familyName 

- (NSString*) familyName;
Availability: OpenStep

Description forthcoming.

fontDescriptor 

- (NSFontDescriptor*) fontDescriptor;
Availability: Not in OpenStep/MacOS-X

Description forthcoming.

fontName 

- (NSString*) fontName;
Availability: OpenStep

Description forthcoming.

glyphIsEncoded: 

- (BOOL) glyphIsEncoded: (NSGlyph)aGlyph;
Availability: OpenStep

Description forthcoming.

glyphPacking 

- (NSMultibyteGlyphPacking) glyphPacking;
Availability: OpenStep

Description forthcoming.

glyphWithName: 

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

Description forthcoming.

isBaseFont 

- (BOOL) isBaseFont;
Availability: OpenStep

Description forthcoming.

isFixedPitch 

- (BOOL) isFixedPitch;
Availability: OpenStep

Description forthcoming.

italicAngle 

- (CGFloat) italicAngle;
Availability: OpenStep

Description forthcoming.

matrix 

- (const CGFloat*) matrix;
Availability: OpenStep

Description forthcoming.

maximumAdvancement 

- (NSSize) maximumAdvancement;
Availability: OpenStep

Description forthcoming.

minimumAdvancement 

- (NSSize) minimumAdvancement;
Availability: OpenStep

Description forthcoming.

mostCompatibleStringEncoding 

- (NSStringEncoding) mostCompatibleStringEncoding;
Availability: OpenStep

Description forthcoming.

numberOfGlyphs 

- (NSUInteger) numberOfGlyphs;
Availability: MacOS-X 10.0.0

Description forthcoming.

pointSize 

- (CGFloat) pointSize;
Availability: OpenStep

Description forthcoming.

positionOfGlyph: forCharacter: struckOverRect: 

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

Description forthcoming.

positionOfGlyph: precededByGlyph: isNominal: 

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

Description forthcoming.

positionOfGlyph: struckOverGlyph: metricsExist: 

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

Description forthcoming.

positionOfGlyph: struckOverRect: metricsExist: 

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

Description forthcoming.

positionOfGlyph: withRelation: toBaseGlyph: totalAdvancement: metricsExist: 

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

Description forthcoming.

positionsForCompositeSequence: numberOfGlyphs: pointArray: 

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

Description forthcoming.

printerFont 

- (NSFont*) printerFont;
Availability: OpenStep

Description forthcoming.

renderingMode 

- (NSFontRenderingMode) renderingMode;
Availability: Not in OpenStep/MacOS-X

Description forthcoming.

screenFont 

- (NSFont*) screenFont;
Availability: OpenStep

Description forthcoming.

screenFontWithRenderingMode: 

- (NSFont*) screenFontWithRenderingMode: (NSFontRenderingMode)mode;
Availability: Not in OpenStep/MacOS-X

Description forthcoming.

set 

- (void) set;
Availability: OpenStep

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

setInContext: 

- (void) setInContext: (NSGraphicsContext*)context;
Availability: Not in OpenStep/MacOS-X

Description forthcoming.

textTransform 

- (NSAffineTransform*) textTransform;
Availability: Not in OpenStep/MacOS-X

Description forthcoming.

underlinePosition 

- (CGFloat) underlinePosition;
Availability: OpenStep

Description forthcoming.

underlineThickness 

- (CGFloat) underlineThickness;
Availability: OpenStep

Description forthcoming.

widthOfString: 

- (CGFloat) widthOfString: (NSString*)string;
Availability: OpenStep

Description forthcoming.

xHeight 

- (CGFloat) xHeight;
Availability: OpenStep

Description forthcoming.



Instance Variables for NSFont Class

_fontRef

@protected void* _fontRef;
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.

cachedFlippedFont

@protected NSFont* cachedFlippedFont;
Availability: OpenStep

Description forthcoming.

cachedScreenFont

@protected NSFont* cachedScreenFont;
Availability: OpenStep

Description forthcoming.

fontInfo

@protected id fontInfo;
Availability: OpenStep

Description forthcoming.

fontName

@protected NSString* fontName;
Availability: OpenStep

Description forthcoming.

matrix

@protected CGFloat matrix;
Availability: OpenStep

Description forthcoming.

matrixExplicitlySet

@protected BOOL matrixExplicitlySet;
Availability: OpenStep

Description forthcoming.

role

@protected int role;
Availability: OpenStep

Description forthcoming.

screenFont

@protected BOOL screenFont;
Availability: OpenStep

Description forthcoming.




Software documentation for the NSFont(GNUstep) category

NSFont(GNUstep)

Declared in:
AppKit/NSFont.h
Availability: MacOS-X 10.0.0

Description forthcoming.
Method summary

fontInfo 

- (GSFontInfo*) fontInfo;
Availability: MacOS-X 10.0.0

Description forthcoming.

fontRef 

- (void*) fontRef;
Availability: MacOS-X 10.0.0

Description forthcoming.


Up