Prova

Page 195

CHAPTER 16

Text

Attribute

Function

Specifies

Text position

CGContextSetTextPosition

The location at which text is drawn.

The text matrix is a transform that operates similarly to the way the current transformation matrix (CTM) operates, but only on text. You can apply transforms to the text matrix, using any of the affine transform functions to build as complex a transform as you’d like. When you draw the text, Quartz uses the text matrix you supply along with the CTM. When you draw anything other than text, Quartz uses the CTM and not the text matrix. Table 16-2

Text drawing modes

Use this mode

When you want to . . .

Example

kCGTextFill

Perform a fill operation on the text.

text

kCGTextStroke

Perform a stroke operation on the text.

text

kCGTextFillStroke

Perform both fill and stroke operations on the text.

text

kCGTextInvisible

Get text positions for the purpose of measuring text but not display the text. Note that the text position (x, y) is updated, as with all of the drawing modes.

C

kCGTextFillClip

Perform a fill operation, then add the text to the clipping area.

text xt

kCGTextStrokeClip

Perform a stroke operation, then add the text to the clipping area.

text

kCGTextFillStrokeClip Perform both fill and stroke operations, then add the text to

the clipping area. kCGTextClip

Add the text to the clipping area, but do not draw the text.

text text

Drawing Text When you use Quartz 2D to draw text, you need to perform these tasks: ●

Set the font and font size.

Drawing Text 2010-11-19 | © 2001, 2010 Apple Inc. All Rights Reserved.

195


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.