Crystal
Crystal

Reputation: 29518

CGContextMoveToPoint before CGContextShowText call

Does CGContextMoveToPoint work with CGContextShowText? I'm trying to draw to a PDF. Without any translating of the CTM, if I draw text, I see it in the bottom left side of the screen. Then I try to move to point (100,100), and the text is still there. But if I translate the CTM to position 100, 100, then I see the text at that point. Does CGContextMoveToPoint work with CGContextShowText? Otherwise it seems like I translate my CTM, then I need to make the reverse translation, then move it somewhere else to draw other text (like if I were doing a title, and then starting a paragraph). Thanks!

Upvotes: 0

Views: 455

Answers (1)

Stefan Werner
Stefan Werner

Reputation: 440

You need to use CGContextSetTextPosition() instead. I don't know why Quartz keeps different positions for text and graphics, but that's the way it is.

Upvotes: 1

Related Questions