Tag:

用UIBezierPath单行绘制字母(文本)

我正在使用这个和这个参考。 我是新的使用UIBezierPath,我想绘制字符(字母)代码我使用的path如下。 CGMutablePathRef letters = CGPathCreateMutable(); CTFontRef font = CTFontCreateWithName(CFSTR("Courier New"), 200.0f, NULL); NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:CFBridgingRelease(font), kCTFontAttributeName,nil]; NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:@"B" attributes:attrs]; CTLineRef line = CTLineCreateWithAttributedString((CFAttributedStringRef)attrString); CFArrayRef runArray = CTLineGetGlyphRuns(line); // for each RUN for (CFIndex runIndex = 0; runIndex < CFArrayGetCount(runArray); runIndex++) { // Get FONT for this run CTRunRef […]