2012-05-29 59 views
9

如何在iOS SDK中使用Glyph從角色獲得UIBezierPath如何在iOS SDK中使用Glyph獲取UIBezierpath

我已通過this走了,但它顯示雙行,我想只有一行..

正如我在這個research..Please新幫我解決這個問題..我不想任何代碼,但想從你參考..

其實我想UIBezierPath描述字母的每一個字母的形狀..提前

謝謝..

回答

4

我碰巧有要爲我正在處理的項目執行此操作,我發現此參考非常有用:Low-level text rendering

,我用來創建從字形路徑的核心代碼(調整你的情況):

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);