PDA

View Full Version : Silly Question: can you use your own font in an app?




Greencardman
Aug 20, 2008, 11:52 AM
So I'm working on some of my ideas, and before I get into it to much, can you choose to use any font, font size or style for text inside a native iPhone app?



grimjim
Aug 22, 2008, 04:29 AM
I would guess that you can't install arbitrary fonts onto the iPhone, but you should be able to use any of the fonts that are already installed. The class reference docs for UIFont give some useful ways of listing the available fonts and using them.

Luke Redpath
Aug 22, 2008, 08:44 AM
You'll probably have to use an image if want to use your own typeface for UI elements.

Greencardman
Aug 22, 2008, 08:55 AM
So a trivia game where I wanted the question to appear in a certain font would have to use a default font or have a separate image for each question?

I assume you can change the size of the default font, but are there different weights and styles (ie. bold, italics, etc.) Is there a list of the default fonts somewhere that I can look at?

Luke Redpath
Aug 22, 2008, 09:13 AM
So a trivia game where I wanted the question to appear in a certain font would have to use a default font or have a separate image for each question?

Yes, and I'd recommend the latter.


I assume you can change the size of the default font, but are there different weights and styles (ie. bold, italics, etc.) Is there a list of the default fonts somewhere that I can look at?

You can:


NSLog(@"%@", [UIFont familyNames]);


http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIFont_Class/Reference/Reference.html

Small White Car
Aug 22, 2008, 09:35 AM
Here are the fonts that are on the phone already:

http://daringfireball.net/2007/07/iphone_fonts

There's a link to a PDF chart in that article which may be helpful.

Greencardman
Aug 22, 2008, 09:53 AM
Thanks guys, that works awesome. Having the default being Helvetica isn't actually that bad. Why would you recommend each question being an image? I'm thinking once I get to hundred of questions and answers, it might get out of hand that way.

ArtOfWarfare
Aug 22, 2008, 09:59 AM
If I were trying to do something like have a custom font, I think I would just design each character that you'll need and then write the code to replace any text string with the appropriate images. It'd probably be a challenge if you're just starting (like me...) but I'm confident that it's possible without many lines of code at all.

Greencardman
Aug 22, 2008, 10:21 AM
I'm not the coder, I'm just doing the game design and background work. I'm not a big fan of the aqua blue and grey on the iPhone, so I was investigating ways to make the interface look better using some really great graphic design. I realized that if I didn't have a pick of good fonts, spending my time coming up with designs would be a waste of my time, time I could use working on other parts of the app.

I actually like helvetica, so thats good. But like I said, there's likely to be lots of questions and answers, so having an image for each one would be time consuming, and would make updates time consuming as well. Having an image for each letter makes it more streamlined, but that increases the coding needed, like you said.

Thanks for everyone's answers, you've been a big help.

Luke Redpath
Aug 22, 2008, 12:36 PM
Why would you recommend each question being an image?.

Sorry, I meant the former (It's Friday!). I wouldn't recommend it.

robbieduncan
Aug 22, 2008, 12:41 PM
I wouldn't recommend using images at all. Just use one of the built in fonts.

Greencardman
Aug 22, 2008, 01:01 PM
Yeah, it is a Friday. Thanks for clarifying that. :)