Has anyone had success using custom otf fonts on the iPhone?

后端 未结 6 644
粉色の甜心
粉色の甜心 2020-12-23 11:45

It looks like there a few working solutions for using custom true type fonts (ttf) on the iPhone, most notably Can I embed a custom font in an iPhone application? However,

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-23 12:18

    For my own project I wanted to use the opentype font and I basically used this method:

    Add your custom font file into your project using XCode as a resource Add a key to your info.plist file (Fonts provided by application) For each font you have, enter the full name of your font file (including the extension) save info.plist then use this for your labels (ex:)

    UIFont* font = [UIFont fontWithName:@"Harrowprint" size:20];
    

    In my case @"Harrowprint" was the filename without the extension and not the font name provided by Finder.

    My font was an otf and it worked...so I guess it's supported...or I was lucky. I'll test another font..and keep you posted..

    references:

    • http://blog.beefyapps.com/2010/06/custom-fonts-in-ios-4/
    • Can I embed a custom font in an iPhone application?

提交回复
热议问题