Mac OS X provides extensive support for advanced typography for both Carbon and Cocoa programs. These APIs let you control the fonts, layout, typesetting, text input, and text storage in your programs and are described in the following sections. For guidance on choosing the best technology for your needs, see Getting Started with Text and Fonts.
Cocoa Text
Core Text
Apple Type Services
Apple Type Services for Unicode Imaging
Multilingual Text Engine
Cocoa provides advanced text-handling capabilities in the Application Kit framework. Based on Core Text, the Cocoa text system provides a multilayered approach to implementing a full-featured text system using Objective-C. This layered approach lets you customize portions of the system that are relevant to your needs while using the default behavior for the rest of the system. You can use Cocoa Text to display small or large amounts of text and can customize the default layout manager classes to support custom layout.
Although part of Cocoa, the Cocoa text system can also be used in Carbon-based applications. If your Carbon application displays moderate amounts of read-only or editable text, you can use HIView wrappers for the NSString, NSTextField, and NSTextView classes to implement that support. Using wrappers is much easier than trying to implement the same behavior using lower-level APIs, such as Core Text, ATSUI, or MLTE. For more information on using wrapper classes, see Carbon-Cocoa Integration Guide.
For an overview of the Cocoa text system, see Text System Overview.
Introduced in Mac OS X v10.5, Core Text is a C-based API that provides you with precise control over text layout and typography. Core Text provides a layered approach to laying out and displaying Unicode text. You can modify as much or as little of the system as is required to suit your needs. Core Text also provides optimized configurations for common scenarios, saving setup time in your application. Designed for performance, Core Text is up to twice as fast as ATSUI (see “Apple Type Services for Unicode Imaging”), the text-handling technology that it replaces.
The Core Text font API is complementary to the Core Text layout engine. Core Text font technology is designed to handle Unicode fonts natively and comprehensively, unifying disparate Mac OS X font facilities so that developers can do everything they need to do without resorting to other APIs.
Carbon and Cocoa developers who want a high-level text layout API should consider using the Cocoa text system and the supporting Cocoa text views. Unless you need low-level access to the layout manager routines, the Cocoa text system should provide most of the features and performance you need. If you need a lower-level API for drawing any kind of text into a CGContext, then you should consider using the Core Text API.
For more information about Core Text, see Core Text Programming Guide and Core Text Reference Collection.
Apple Type Services (ATS) is an engine for the systemwide management, layout, and rendering of fonts. With ATS, users can have a single set of fonts distributed over different parts of the file system or even over a network. ATS makes the same set of fonts available to all clients. The centralization of font rendering and layout contributes to overall system performance by consolidating expensive operations such as synthesizing font data and rendering glyphs. ATS provides support for a wide variety of font formats, including TrueType, PostScript Type 1, and PostScript OpenType. For more information about ATS, see Apple Type Services for Fonts Programming Guide.
Note: In Mac OS X v10.5 and later, you should consider using the Core Text font-handling API instead of this technology. For more information, see “Core Text.”
Apple Type Services for Unicode Imaging (ATSUI) is the technology behind all text drawing in Mac OS X. ATSUI gives developers precise control over text layout features and supports high-end typography. It is intended for developers of desktop publishing applications or any application that requires the precise manipulation of text. For information about ATSUI, see ATSUI Programming Guide.
Note: In Mac OS X v10.5 and later, you should consider using the Core Text API instead of this technology. For more information, see “Core Text.”
The Multilingual Text Engine (MLTE) is an API that provides Carbon-compliant Unicode text editing. MLTE replaces TextEdit and provides an enhanced set of features, including document-wide tabs, text justification, built-in scroll bar handing, built-in printing support, inline input, multiple levels of undo, support for more than 32 KB of text, and support for Apple Type Services. This API is designed for developers who want to incorporate a full set of text editing features into their applications but do not want to worry about managing the text layout or typesetting. For more information about MLTE, see Handling Unicode Text Editing With MLTE.
In Mac OS X v10.5 and later, the QuickDraw-related features of MLTE are deprecated. The features that use HITextView are still supported, however.
Note: In Mac OS X v10.5 and later, you should consider using the Core Text API instead of this technology. For more information, see “Core Text.”
Last updated: 2007-10-31