美文网首页
ios获取ttf字体文件的familyName

ios获取ttf字体文件的familyName

作者: xiaoliang1 | 来源:发表于2022-06-02 15:35 被阅读0次

    废话不多说,直接上代码

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

    相关文章

      网友评论

          本文标题:ios获取ttf字体文件的familyName

          本文链接:https://www.haomeiwen.com/subject/fhuqmrtx.html