Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get UIBezierpath using Glyph in iOS SDK

How can we get UIBezierPath from a character using Glyph in iOS SDK.

I had gone through this, but It is showing double line and I want only single line..

As I am new in this research..Please help me to solve this problem.. I do not want any code but want to get reference from you..

Actually I want to get UIBezierPath describing the shape of each letter of alphabets..

Thanks in advance..

like image 318
Mehul Mistri Avatar asked May 29 '12 06:05

Mehul Mistri


1 Answers

I happen to have had to do this for a project I am working on, I found this reference very helpful: Low-level text rendering.

The core code that I used to create a path from a glyph (adjusted for your case):

CGGlyph glyph = ...;
CTFontRef font = CTFontCreateWithName((__bridge CFStringRef)@"Helvetica", 25, NULL);
CGAffineTransform transform = CGAffineTransformIdentity;
CGPathRef path = CTFontCreatePathForGlyph(font, glyph, &transform);
UIBezierPath *bezier = [UIBezierPath bezierPathWithCGPath:path];
CGPathRelease(path);
CFRelease(font);
like image 181
Patrick Pijnappel Avatar answered Sep 28 '22 01:09

Patrick Pijnappel