Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /


Chapter 3 - QuickDraw Text

This chapter describes the text-handling components of QuickDraw. You can use the QuickDraw text routines to measure and draw text ranging in complexity from a single glyph to a line of justified text containing multiple languages and styles. In addition to measuring and drawing text, the QuickDraw text routines also help you to determine which characters to highlight and where to position the caret to mark the insertion point. These routines translate pixel locations into byte offsets and vice versa.

Read this chapter if you are writing an application that draws static text in a box, such as a dialog box, or draws and manipulates text of any length in one or more languages. Before you use the routines described in this chapter, read the chapter "Introduction to Text on the Macintosh" in this book. To understand the concepts and routines described in this chapter, you must be familiar with the other parts of QuickDraw described in Inside Macintosh: Imaging.

Read this chapter along with the chapter "Font Manager," in this book, because of the close relationship between QuickDraw and the Font Manager. For help in understanding the tasks involved in text layout, refer to the chapters "Text Utilities" and "Script Manager," also in this book.

This chapter explains how to set up the text-drawing environment and lay out and draw text, including how to


Chapter Contents
About QuickDraw Text
Graphics Ports and Text Drawing
Font, Font Style, and Font Size
Transfer Modes
QuickDraw Text, Script Systems, and Other Managers
Text Formatting and Justification
Scaling
Carets and Highlighting
Using QuickDraw Text
Preparing to Use QuickDraw
Determining the Version and Initializing QuickDraw
Setting Up the Text-Drawing Environment
Specifying Text Characteristics
Setting the Font
Modifying the Text Style
Changing the Font Size
Changing the Width of Characters
Using Fractional Glyph Widths
Specifying the Transfer Mode
Basic Transfer Mode Operations
Arithmetic Transfer Mode Operations
The grayishTextOr Transfer Mode
Text Mask Mode
Transparent Transfer Mode
Transfer Modes and Multibit Fonts
Measuring and Drawing Single Segments of Text
Individual Glyphs
Pascal Strings
Text Segments
Measuring and Drawing Lines of Text
Determining Where to Break the Line
Determining the Display Order for Style Runs
Eliminating Trailing Spaces (for Justified Text)
Calculating the Slop Value (for Justified Text)
Allocating the Slop to Each Style Run (for Justified Text)
Drawing the Line of Text
Using Scaled Text
Drawing Carets and Highlighting
Converting an Onscreen Pixel Location to a Byte Offset
Finding a Caret Position and Drawing a Caret
Synchronizing the Caret With the Keyboard Script
Highlighting a Text Selection
Customizing QuickDraw's Text Handling
Text in QuickDraw Pictures
Fonts
Text With Multiple Style Runs
QuickDraw Text Reference
Data Structures
The Font Information Record
The Style Data Type
Routines
The slop Parameter
The styleRunPosition Parameter
The numer and denom Parameters
Setting Text Characteristics
Drawing Text
Measuring Text
Laying Out a Line of Text
Determining the Caret Position, and Selecting and Highlighting Text
Low-Level QuickDraw Text Routines
Application-Supplied Routine
Summary of QuickDraw Text
Pascal Summary
Constants
Data Types
Routines
C Summary
Constants
Types
Routines
Assembly-Language Summary
Trap Macros
Global Variables

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996