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)

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.