Drawing to a PDF context

Sandor Szatmari

I need to replace calls to CGShowTextAtPoint() with calls to -drawAtPoint:withAttributes:

I made this change and drawing fails… :/
i.e. no text rendered, no exception, logging of errors, etc. simply no text
The CG implementation of this code has been working with no leaks, crashes, etc for at least 10+ years.

Original context is created as follows:
CGContextRef ctx;
ctx = CGPDFContextCreateWithURL(…)

I tried setting the current NS graphics context like so

[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithCGContext:ctx flipped:NO]

… but this causes the app to crash.

Any thoughts? Is this an ownership issue? Should I be letting the NSGraphics side of things know not to dispose of the context…

Thanks in advance,

Join cocoa@apple-dev.groups.io to automatically receive all group messages.