Apple Developer Connection
Advanced Search
Member Login Log In | Not a Member? Contact ADC

Getting Started with Text & Fonts

Technology Overview

Text and fonts permeate the user experience on any computer, regardless of the operating system. The two work together: text provides the written representation of a language and a font provides a set of character representations (glyphs) in a particular typeface that is used to render text to a display or a printer.

When designing your application, you’ll want to take advantage of Apple’s built-in support for high-quality text rendering, resolution-independent fonts, and Unicode. You use the Mac OS X APIs for text and fonts to take advantage of the built-in support as well as to customize text and font handling so that your application can:

  • Allow users to enter text in an editable text field

  • Create, copy, compare, and search for text strings as well as convert between string encodings and perform other operations on strings

  • Support text editing to allow the user to enter and change text in a document

  • Control how text is laid out and rendered to enable sophisticated typography

  • Track, activate and deactivate fonts and access font data (manage fonts)

The text system in Mac OS X is layered. Typically you write code using high-level APIs. For specialized needs you can use lower-level APIs or Quartz directly.


Text system functional block diagram

Start Here

Before you write code that works with text and fonts, read:

Java (J2SE) developers can read “Java 2D” in Java Development Guide for Mac OS X to learn how Java text and graphics in Mac OS X differ from Java text and graphics on other platforms.

Choose a Learning Path

Whether you’re developing in procedural C or Objective-C, you can use Apple’s superior user experience for text and fonts to improve your application. You might want to allow users to enter text in an editable field, support basic text editing, support sophisticated typography, manipulate text strings, or manage fonts. Java (J2SE) developers can consult the Sun Java website.

If you develop in procedural C, use the Carbon frameworks. If you develop in Objective-C, use the Cocoa frameworks. The following subsections provide cross-references to Carbon and Cocoa documents appropriate to specific tasks.

Creating a Text Editing Field

You can use Interface Builder to provide editable text fields for data entry and editing of small amounts of text. In Interface Builder, you can get a text field by simply dragging a one from the text palette to the appropriate window. Carbon applications use the field EditText; Cocoa applications use the field NSTextField. Read Mac OS X Technology Overview and Interface Builder User Guide for more details.

Working with Text Strings

You can create, copy, compare, and search for text strings, convert between string encodings, and perform a number of other operations on string data.

Supporting Text Editing

You can add text editing capabilities to your application so that users can create and edit documents.

Supporting Sophisticated Typography

You can customize text layout and rendering when you need more than what’s built in to Mac OS X.

  • If you are using procedural C, read Core Text Programming Guide to learn how to lay out, process and draw text and how to manipulate glyphs.

Managing Fonts

You can programmatically manage fonts individually or as a group and provide an interface for users to change fonts.

  • If you are using Objective-C, read Font Handling to learn about fonts and the Cocoa font management system and user interface.

Next Steps

The Text & Fonts Reference Library contains some resources you’ll want to keep up to date with. You can bookmark each of them for easy access:

  • Guides

    Conceptual and how-to information for text and fonts.

  • Reference

    Focused, detailed descriptions in reference format for text and fonts.

  • Release Notes

    Late-breaking news and highlights of new or changed features in the latest release.

  • Sample Code

    Samples demonstrating how to use text and fonts.

  • Technical Notes

    Late-breaking documents on timely technology issues related to text and fonts.

  • Technical Q&As

    Programming tips, code snippets, & FAQs by Apple’s support engineers.



Last updated: 2007-12-11




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.