Up
Authors
- Ovidiu Predescu (
ovidiu@net-community.com
)
-
The font class
Copyright: (C) 1996 Free Software Foundation, Inc.
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 6
-
NSMessageFontSize (none)
-
NSPaletteFontSize (none)
-
NSSmallFontSize 9
-
NSTitleBarFontSize (none)
-
NSToolTipsFontSize (none)
-
NSUserFixedPitchFontSize (none)
-
NSUserFontSize (none)
Font sizes list with (none) default to NSFontSize.
- Declared in:
- AppKit/NSFont.h
- Conforms to:
- NSCoding
- NSCopying
Availability: OpenStep
Description forthcoming.
Instance Variables
Method summary
+ (
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:
+ (
NSFont*)
controlContentFontOfSize: (
CGFloat)fontSize;
Availability: MacOS-X 10.0.0
Description forthcoming.
+ (
NSFont*)
fontWithDescriptor: (NSFontDescriptor*)descriptor
size: (
CGFloat)size;
Availability: MacOS-X 10.4.0
Description forthcoming.
+ (
NSFont*)
fontWithDescriptor: (NSFontDescriptor*)descriptor
size: (
CGFloat)size
textTransform: (
NSAffineTransform*)transform;
Availability: MacOS-X 10.4.0
Description forthcoming.
+ (
NSFont*)
fontWithDescriptor: (NSFontDescriptor*)descriptor
textTransform: (
NSAffineTransform*)transform;
Availability: MacOS-X 10.4.0
Description forthcoming.
+ (
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.
+ (
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.
+ (
NSFont*)
labelFontOfSize: (
CGFloat)fontSize;
Availability: MacOS-X 10.0.0
Description forthcoming.
+ (
CGFloat)
labelFontSize;
Availability: MacOS-X 10.0.0
Description forthcoming.
+ (
NSFont*)
menuBarFontOfSize: (
CGFloat)fontSize;
Availability: MacOS-X 10.0.0
Description forthcoming.
+ (
NSFont*)
menuFontOfSize: (
CGFloat)fontSize;
Availability: MacOS-X 10.0.0
Description forthcoming.
+ (
NSFont*)
messageFontOfSize: (
CGFloat)fontSize;
Availability: MacOS-X 10.0.0
Description forthcoming.
+ (
NSFont*)
paletteFontOfSize: (
CGFloat)fontSize;
Availability: MacOS-X 10.0.0
Description forthcoming.
+ (
NSArray*)
preferredFontNames;
Availability: OpenStep
+ (void)
setPreferredFontNames: (
NSArray*)fontNames;
Availability: OpenStep
+ (void)
setUserFixedPitchFont: (
NSFont*)aFont;
Availability: OpenStep
Description forthcoming.
+ (void)
setUserFont: (
NSFont*)aFont;
Availability: OpenStep
Description forthcoming.
+ (
CGFloat)
smallSystemFontSize;
Availability: MacOS-X 10.0.0
Description forthcoming.
+ (
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:
+ (
CGFloat)
systemFontSize;
Availability: MacOS-X 10.0.0
Description forthcoming.
+ (
CGFloat)
systemFontSizeForControlSize: (
NSControlSize)controlSize;
Availability: MacOS-X 10.0.0
Description forthcoming.
+ (
NSFont*)
titleBarFontOfSize: (
CGFloat)fontSize;
Availability: MacOS-X 10.0.0
Description forthcoming.
+ (
NSFont*)
toolTipsFontOfSize: (
CGFloat)fontSize;
Availability: MacOS-X 10.0.0
Description forthcoming.
+ (void)
useFont: (
NSString*)aFontName;
Availability: OpenStep
Description forthcoming.
+ (
NSFont*)
userFixedPitchFontOfSize: (
CGFloat)fontSize;
Availability: OpenStep
+ (
NSFont*)
userFontOfSize: (
CGFloat)fontSize;
Availability: OpenStep
- (
NSSize)
advancementForGlyph: (
NSGlyph)aGlyph;
Availability: OpenStep
Description forthcoming.
- (
NSDictionary*)
afmDictionary;
Availability: OpenStep
Description forthcoming.
- (
NSString*)
afmFileContents;
Availability: OpenStep
This method returns nil
in the GNUstep
implementation
- (
CGFloat)
ascender;
Availability: OpenStep
Description forthcoming.
- (
NSRect)
boundingRectForFont;
Availability: OpenStep
Description forthcoming.
- (
NSRect)
boundingRectForGlyph: (
NSGlyph)aGlyph;
Availability: OpenStep
Description forthcoming.
- (
CGFloat)
capHeight;
Availability: OpenStep
Description forthcoming.
- (
NSCharacterSet*)
coveredCharacterSet;
Availability: MacOS-X 10.0.0
Description forthcoming.
- (
CGFloat)
defaultLineHeightForFont;
Availability: OpenStep
Description forthcoming.
- (
CGFloat)
descender;
Availability: OpenStep
Description forthcoming.
- (
NSString*)
displayName;
Availability: OpenStep
Description forthcoming.
- (
NSString*)
encodingScheme;
Availability: OpenStep
Description forthcoming.
- (
NSString*)
familyName;
Availability: OpenStep
Description forthcoming.
- (NSFontDescriptor*)
fontDescriptor;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString*)
fontName;
Availability: OpenStep
Description forthcoming.
- (void)
getAdvancements: (
NSSizeArray)advancements
forGlyphs: (const
NSGlyph*)glyphs
count: (
NSUInteger)count;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
getAdvancements: (
NSSizeArray)advancements
forPackedGlyphs: (const void*)glyphs
count: (
NSUInteger)count;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
getBoundingRects: (
NSRectArray)bounds
forGlyphs: (const
NSGlyph*)glyphs
count: (
NSUInteger)count;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (BOOL)
glyphIsEncoded: (
NSGlyph)aGlyph;
Availability: OpenStep
Description forthcoming.
- (
NSGlyph)
glyphWithName: (
NSString*)glyphName;
Availability: OpenStep
Description forthcoming.
- (BOOL)
isBaseFont;
Availability: OpenStep
Description forthcoming.
- (BOOL)
isFixedPitch;
Availability: OpenStep
Description forthcoming.
- (
CGFloat)
italicAngle;
Availability: OpenStep
Description forthcoming.
- (
CGFloat)
leading;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (const
CGFloat*)
matrix;
Availability: OpenStep
Description forthcoming.
- (
NSSize)
maximumAdvancement;
Availability: OpenStep
Description forthcoming.
- (
NSSize)
minimumAdvancement;
Availability: OpenStep
Description forthcoming.
- (
NSStringEncoding)
mostCompatibleStringEncoding;
Availability: OpenStep
Description forthcoming.
- (
NSUInteger)
numberOfGlyphs;
Availability: MacOS-X 10.0.0
Description forthcoming.
- (
CGFloat)
pointSize;
Availability: OpenStep
Description forthcoming.
- (
NSPoint)
positionOfGlyph: (
NSGlyph)aGlyph
forCharacter: (
unichar)aChar
struckOverRect: (
NSRect)aRect;
Availability: OpenStep
Description forthcoming.
- (
NSPoint)
positionOfGlyph: (
NSGlyph)curGlyph
precededByGlyph: (
NSGlyph)prevGlyph
isNominal: (BOOL*)nominal;
Availability: OpenStep
Description forthcoming.
- (
NSPoint)
positionOfGlyph: (
NSGlyph)aGlyph
struckOverGlyph: (
NSGlyph)baseGlyph
metricsExist: (BOOL*)flag;
Availability: OpenStep
Description forthcoming.
- (
NSPoint)
positionOfGlyph: (
NSGlyph)aGlyph
struckOverRect: (
NSRect)aRect
metricsExist: (BOOL*)flag;
Availability: OpenStep
Description forthcoming.
- (
NSPoint)
positionOfGlyph: (
NSGlyph)aGlyph
withRelation: (
NSGlyphRelation)relation
toBaseGlyph: (
NSGlyph)baseGlyph
totalAdvancement: (
NSSize*)offset
metricsExist: (BOOL*)flag;
Availability: OpenStep
Description forthcoming.
- (int)
positionsForCompositeSequence: (
NSGlyph*)glyphs
numberOfGlyphs: (int)numGlyphs
pointArray: (
NSPoint*)points;
Availability: OpenStep
Description forthcoming.
- (
NSFont*)
printerFont;
Availability: OpenStep
Description forthcoming.
- (
NSFont*)
screenFont;
Availability: OpenStep
Description forthcoming.
- (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
- (void)
setInContext: (
NSGraphicsContext*)context;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSAffineTransform*)
textTransform;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
CGFloat)
underlinePosition;
Availability: OpenStep
Description forthcoming.
- (
CGFloat)
underlineThickness;
Availability: OpenStep
Description forthcoming.
- (
CGFloat)
widthOfString: (
NSString*)string;
Availability: OpenStep
Description forthcoming.
- (
CGFloat)
xHeight;
Availability: OpenStep
Description forthcoming.
Instance Variables for NSFont Class
@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.
@protected NSFont* cachedFlippedFont;
Availability: OpenStep
Description forthcoming.
@protected NSFont* cachedScreenFont;
Availability: OpenStep
Description forthcoming.
@protected id fontInfo;
Availability: OpenStep
Description forthcoming.
@protected NSString* fontName;
Availability: OpenStep
Description forthcoming.
@protected CGFloat matrix;
Availability: OpenStep
Description forthcoming.
@protected BOOL matrixExplicitlySet;
Availability: OpenStep
Description forthcoming.
@protected int role;
Availability: OpenStep
Description forthcoming.
@protected BOOL screenFont;
Availability: OpenStep
Description forthcoming.
- Declared in:
- AppKit/NSFont.h
Availability: MacOS-X 10.0.0
Description forthcoming.
Method summary
- (GSFontInfo*)
fontInfo;
Availability: MacOS-X 10.0.0
Description forthcoming.
- (void*)
fontRef;
Availability: MacOS-X 10.0.0
Description forthcoming.
Up