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

后端 未结 6 614
粉色の甜心
粉色の甜心 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:17

    I researched this throughly, and this is the best method I found:

    1) Convert font file to TTF using this online tool: http://www.freefontconverter.com/

    2) Add the TTF files to your project

    3) Make some configurations to your info.plist file:

    3.1) Edit info.plist as source code (right click on file -> open as -> source code)

    3.2) Add this:

     UIAppFonts
     
      font1.ttf
      font2.ttf
      ...etc...
     
    

    3.3) Your info.plist should have this now:

    info plist should look like this now

    4) Use the new fonts just like the system fonts:

    [UIFont fontWithName:@"font1" size:16.0];

    (Notice no ".ttf" in the font name)

提交回复
热议问题