# NSFont

ovidiu@net-community.com
Generated at 2026-02-17 21:02:56 +0000

The font class

1996 Free Software Foundation, Inc.
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
NSMenuBarFont 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)
NSMiniFontSize 8
NSMessageFontSize (none)
NSPaletteFontSize (none)
NSSmallFontSize 10
NSTitleBarFontSize (none)
NSToolTipsFontSize (none)
NSUserFixedPitchFontSize (none)
NSUserFontSize (none)

Font sizes list with (none) default to NSFontSize.

AppKit/NSFont.h
NSCoding
NSCopying
Description forthcoming.
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.
Description forthcoming.
Description forthcoming.
Description forthcoming.
Description forthcoming.
Description forthcoming.
Description forthcoming.
Description forthcoming.
Description forthcoming.
boldSystemFontOfSize:
fontSize

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:
fontSize
Description forthcoming.
fontWithDescriptor:
descriptor
size:
size
Description forthcoming.
fontWithDescriptor:
descriptor
size:
size
textTransform:
transform
Description forthcoming.
fontWithDescriptor:
descriptor
textTransform:
transform
Description forthcoming.
fontWithName:
aFontName
matrix:
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:
aFontName
size:
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:
fontSize
Description forthcoming.
labelFontSize
Description forthcoming.
menuBarFontOfSize:
fontSize
Description forthcoming.
menuFontOfSize:
fontSize
Description forthcoming.
messageFontOfSize:
fontSize
Description forthcoming.
paletteFontOfSize:
fontSize
Description forthcoming.
preferredFontNames

Returns an array of the names of preferred fonts.

See Also: +setPreferredFontNames:

setPreferredFontNames:
fontNames

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

See Also: +preferredFontNames

setUserFixedPitchFont:
aFont
Description forthcoming.
setUserFont:
aFont
Description forthcoming.
smallSystemFontSize
Description forthcoming.
systemFontOfSize:
fontSize

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
Description forthcoming.
systemFontSizeForControlSize:
controlSize
Description forthcoming.
titleBarFontOfSize:
fontSize
Description forthcoming.
toolTipsFontOfSize:
fontSize
Description forthcoming.
useFont:
aFontName
Description forthcoming.
userFixedPitchFontOfSize:
fontSize

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:
fontSize

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:
aGlyph
Description forthcoming.
afmDictionary
Description forthcoming.
afmFileContents

This method returns `nil` in the GNUstep implementation

ascender
Description forthcoming.
boundingRectForFont
Description forthcoming.
boundingRectForGlyph:
aGlyph
Description forthcoming.
capHeight
Description forthcoming.
coveredCharacterSet
Description forthcoming.
defaultLineHeightForFont
Description forthcoming.
descender
Description forthcoming.
displayName
Description forthcoming.
encodingScheme
Description forthcoming.
familyName
Description forthcoming.
fontDescriptor
Description forthcoming.
fontName
Description forthcoming.
getAdvancements:
advancements
forGlyphs:
glyphs
count:
count
Description forthcoming.
getAdvancements:
advancements
forPackedGlyphs:
glyphs
count:
count
Description forthcoming.
getBoundingRects:
bounds
forGlyphs:
glyphs
count:
count
Description forthcoming.
glyphIsEncoded:
aGlyph
Description forthcoming.
glyphPacking
Description forthcoming.
glyphWithName:
glyphName
Description forthcoming.
isBaseFont
Description forthcoming.
isFixedPitch
Description forthcoming.
italicAngle
Description forthcoming.
leading
Description forthcoming.
matrix
Description forthcoming.
maximumAdvancement
Description forthcoming.
minimumAdvancement
Description forthcoming.
mostCompatibleStringEncoding
Description forthcoming.
numberOfGlyphs
Description forthcoming.
pointSize
Description forthcoming.
positionOfGlyph:
aGlyph
forCharacter:
aChar
struckOverRect:
aRect
Description forthcoming.
positionOfGlyph:
curGlyph
precededByGlyph:
prevGlyph
isNominal:
nominal
Description forthcoming.
positionOfGlyph:
aGlyph
struckOverGlyph:
baseGlyph
metricsExist:
flag
Description forthcoming.
positionOfGlyph:
aGlyph
struckOverRect:
aRect
metricsExist:
flag
Description forthcoming.
positionOfGlyph:
aGlyph
withRelation:
relation
toBaseGlyph:
baseGlyph
totalAdvancement:
offset
metricsExist:
flag
Description forthcoming.
positionsForCompositeSequence:
glyphs
numberOfGlyphs:
numGlyphs
pointArray:
points
Description forthcoming.
printerFont
Description forthcoming.
renderingMode
Description forthcoming.
screenFont
Description forthcoming.
screenFontWithRenderingMode:
mode
Description forthcoming.
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
setInContext:
context
Description forthcoming.
textTransform
Description forthcoming.
underlinePosition
Description forthcoming.
underlineThickness
Description forthcoming.
widthOfString:
string
Description forthcoming.
xHeight
Description forthcoming.
Software documentation for the NSFont(GNUstep) category
AppKit/NSFont.h
Description forthcoming.
fontInfo
Description forthcoming.
fontRef
Description forthcoming.