9

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..

Mehul Mistri
  • 15,037
  • 14
  • 70
  • 94

1 Answers1

4

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);
Patrick Pijnappel
  • 7,317
  • 3
  • 39
  • 39