Hej fellows,
I\'m currently trying to convert a letter and/or multiple of them to a CGPathRef for manually drawing them into a custom UIView. I tried the way over Co
CTFrameGetPath
returns the path the circumscribes the CTFrame
, not the path generated by drawing the frame. I assume that you're doing the above because you are caching the paths to improve later drawing performance? (Since CTFrame
can easily draw itself into a custom view).
If you really want to get CGPath
, you need to drill all the way down to the CGGlyph
and then use CTFontCreatePathForGlyph
. If you just want to quickly redraw text, I'd probably draw this into a CGLayer
(not CALayer
) with CTFrameDraw
for later reuse.
If you still really want the CGPath
for the glyphs, take a look at Low-level text rendering. The code you need is in there.