views:

1706

answers:

4

I'd like to use some fonts that aren't part of the iPhone OS. I've seen games that use non standard fonts. I can install the fonts, create images for each one in Photoshop and then use those images in the iPhone app. However, I don't think that is a practical way to go. If the color or tint needs to be adjusted (because of background) or size, I'll have to redesign every font I'm using. Is there a better way to do this?

I read this http://stackoverflow.com/questions/360751/can-i-embed-a-custom-font-in-an-iphone-application and downloaded the open source font label app. However, it crashes most of the time when I try using particular fonts. In regards to the last comment about using UIFont with the fontWithName:size, that certainly doesn't work. Your font variable will be nil. Listing all available fonts reveals why - none of the custom fonts are in the list.

I've also read http://stackoverflow.com/questions/566054/how-do-i-include-a-font-with-my-iphone-application, which definitely does not work. Same as last comment in above link.

A: 

I believe the iPhone supports SVG graphics. SVG supports font embedding.

SpliFF
Can you provide more info on how that is done?
4thSpace
I don't own an Iphone however you put glyphs in your SVG file (Adobe Illustrator can do this for you if you "embed glyphs" on export). Glyphs are nothing more than paths mapped to a font symbol. Provided the Iphone SDK can read and render SVGs with glyphs then you're good to go.
SpliFF
A: 

This sadly is not an immediate answer, but it seems that in the future, you will be able to include custom fonts as part of your app:

UIAppFonts (Array - iPhone OS) specifies any application-provided fonts that should be made available through the normal mechanisms. Each item in the array is a string containing the name of a font file (including filename extension) that is located in the application’s bundle. The system loads the specified fonts and makes them available for use by the application when that application is run.

Unfortunately, this works only in iPhone OS 3.2, which is the iPad specific version. It does seem very likely that this feature will be available in future iPhone OS releases.

Link: http://developer.apple.com/iPhone/library/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW18

(this was the only public documentation I could find on Apple's site)

Gordon Christie
+2  A: 

The correct answer is to use FontLabel, which can be found on GitHub. http://github.com/zynga/FontLabel

I've used that code in several real-world project and it's absolutely fantastic.

Cirrostratus
As @David Dunham said, games usually use a different type of font rendering, called bitmap font rendering. It actually shows coordinates from an image rather than math-based vectors and is limited to the size specified in the image.
Cirrostratus
A: 

I've downloaded and implemented FontLabel on my app which seems to work well. However I'm needing to include the ability to use it in a tableview with a viewWithTag. Any ideas on how to modify FontLabel to include this functionality? Sorry, newbie developer so any help most appreciated. Thanks!

Wally
You should post this question as a new question rather than an answer to this question and I'm sure someone will be able to answer.
Cirrostratus