Add .otf font to iphone application

10,690

You need to ensure that you are using the correct name with fonts. It's tricky. Try to open the font with fontbook in mac, or the equivalent in windows. On a mac, when you open the font in fontbook, you should be able to see the exact name under "PostScript name":

OTF Font Sample in Font Book

Then, assuming that you have properly added the font to your project, you should attempt to use it. For example, if you have a *myTextField pointer to a UITextField, and you want to use DIN-Medium 13pt you may set your custom font like so:

myTextField.font = [UIFont fontWithName:@"DIN-Medium" size:13.0f];
Share:
10,690
Piero
Author by

Piero

Updated on July 20, 2022

Comments

  • Piero
    Piero almost 2 years

    i'm trying to use a custom .otf font to my application, but don't work, i have tried the .ttf font and work, but the .otf don't, anyone can help me? there is a way to add .otf font? i read a lot of guide to add font, but for the .otf don't work, this is the font:

    http://www.fontsquirrel.com/fonts/Lobster

  • MobileMon
    MobileMon about 8 years
    I actually have to use the PostScript name, not the full name
  • Artem M
    Artem M about 7 years
    For those who don't know how to see the PostScript name in the Font Book — just press +i.