废话不多说,直接上代码
NSData *data = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"方正兰亭纤黑简体" ofType:@"TTF"]];
CGDataProviderRef dataRef = CGDataProviderCreateWithCFData((__bridge CFDataRef)data);
CGFontRef fontRef = CGFontCreateWithDataProvider(dataRef);
CFStringRef fontName = CGFontCopyFullName(fontRef);
NSLog(@"%@",(__bridge NSString *)fontName);
CFRelease(dataRef);
CFRelease(fontRef);
CFRelease(fontName);