O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

NSFont — Mac OS X 10.0

Synopsis

This class represents a single font in an application. NSAttributedString uses NSFont as an attribute that specifies which font a string should be drawn in. NSFont provides access to all of the characteristics of a font, such as the ascender and descender height, italic angle, underline thickness, and more.

image with no caption

@interface NSFont : NSObject <NSCoding, NSCopying>
                                  // Convenience Constructors
   + (NSFont *)fontWithName:(NSString *)fontName 
                                 matrix:(const float *)fontMatrix;
   + (NSFont *)fontWithName:(NSString *)fontName 
                                 size:(float)fontSize;
                                  // Class Methods
   + (float)labelFontSize;
   + (float)smallSystemFontSize;
   + (float)systemFontSize;
   + (NSFont *)boldSystemFontOfSize:(float)fontSize;
   + (NSFont *)controlContentFontOfSize:(float)fontSize;
   + (NSFont *)labelFontOfSize:(float)fontSize;
   + (NSFont *)menuFontOfSize:(float)fontSize;
   + (NSFont *)messageFontOfSize:(float)fontSize;
   + (NSFont *)paletteFontOfSize:(float)fontSize;
   + (NSArray *)preferredFontNames;
   + (void)setPreferredFontNames:(NSArray *)fontNameArray;
   + (void)setUserFixedPitchFont:(NSFont *)aFont;
   + (void)setUserFont:(NSFont *)aFont;
   + (NSFont *)systemFontOfSize:(float)fontSize;
   + (NSFont *)titleBarFontOfSize:(float)fontSize;
   + (NSFont *)toolTipsFontOfSize:(float)fontSize;
   + (void)useFont:(NSString *)fontName;
   + (NSFont *)userFixedPitchFontOfSize:(float)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required