O'Reilly logo

COCOA PROGRAMMING FOR MAC OS X SECOND EDITION by Aaron Hillegass

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

Chapter 17. Working with Fonts and NSAttributedString

The next step is to get the string to appear in our view. At the end of the chapter, your application will look like Figure 17.1. The character being displayed will change as you type.

Completed Application

Figure 17.1. Completed Application

NSFont

Overall, the class NSFont has basically only two types of methods:

  • Class methods for getting the font you want

  • Methods for getting metrics on the font, such as letter height

Commonly Used Methods in NSFont

  • + (NSFont *)fontWithName:(NSString *)fontName size:(float)fontSize
    
  • This method returns a font object. fontName is a family-face name, such as “HelveticaBoldOblique” or “Times-Roman.” ...

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