Raj
Raj

Reputation: 6015

CGPathRef from text

How can we get path of particular string? I just found out that CTFontCreatePathForGlyph will give CGPathRef , but its will be the outline of text . for example the letter 'O' the path i get from the above method is like a circle with in a circle .. See how we draw the letter 'O' is just one circle. I hope that the above details are enough for to understand my problem.let me know any updates

I need this text path for showing a text drawing animation..

UPDATE please see the below image.(1) shows what i get now..but i need the path like shown in (2)

please see the below image.(1) shows what i get now..but i need the path like shown in (2)

Upvotes: 3

Views: 1039

Answers (1)

Davyd Geyl
Davyd Geyl

Reputation: 4623

Any Bezier path, including that one you get from the glyphs, is just a series of connected Bezier curves. What you see on the screen is the result of rendering the path by CGContext. The path can be stroked, in this case you will see just the outline.

Also it can be filled, in this case the internal regions are filled with colour or pattern. Use CGContextFillPath() to fill your path with colour. Winding rules define how to fill the path if it has intersecting zones.

Upvotes: 1

Related Questions