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, this method does not support open type fonts (otf).
Has anyone come across a way to make use of otf typefaces?
Add the Font File to Your Xcode Project To add a font file to your Xcode project, select File > Add Files to “Your Project Name” from the menu bar, or drag the file from Finder and drop it into your Xcode project. You can add True Type Font (. ttf) and Open Type Font (. otf) files.
The TrueType font is the most common font format used by both Mac OS X and Windows platforms. TTF package containing the font included both the screen and the printer font data in a single file.
The Differences Between OTF and TTF For most of us non-designers, the additional options will likely go unused. In other words, OTF is indeed the "better" of the two due to the additional features and options, but for the average computer user, those differences don't really matter.
You can download fonts from the App Store app , then use them in documents you create on iPhone. After you download an app containing fonts from the App Store, open the app to install the fonts. To manage installed fonts, go to Settings > General, then tap Fonts.
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:
Must you use an otf font on the device or can you convert it to ttf? It is relatively straightforward to convert an OTF font to a TTF font using a tool such as fontforge, perhaps that would be an easy solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With