So we have an occasion to be interested in embedding custom fonts in an iPhone application. Specifically, this DS-Digital font. It turns out that custom fonts are not quite as easy as one would hope to work with in an iPhone application. As a matter of fact, if you look around the ‘net, you’ll find opinions ranging from “it would be really hard” to “it’s not actually possible”, with people doing things like rendering fonts into UIImages to do that kind of thing since they can’t sort it out from the documentation. Yoiks! We’re looking for something rather more transparent than that! (Although we do note that the tool linked there would be quite handy indeed for using custom fonts in actual OpenGL work, like games … as would that author’s texture creator here.)
But fear not — although rather (unduly, in fact, someone less gracious than ourselves might observe…) challenging, it is, indeed, perfectly possible to use honest-to-goodness embedded CGFonts for text rendering in your iPhone app! To skip over lightly all the pitfalls, simply download this fine, fine piece of work which sorts out all the issues with a FontManager class to load the fonts and a FontLabel class to display them, with a CGFontRef-savviness category on NSString to help out … and:
Sweet! The only trivial bit of trickery left to use it exactly as provided is to make sure that your font file name matches the font contained therein. Which the DOS-friendly filename from the above link didn’t, of course. But that is trivially corrected by double-clicking it in the Finder and reading off the name it displays.
So now that you know how, let’s round up sources of free fonts for your embedding joy, shall we? We focus on free sources here not because we’re cheap but because common license terms of commercial fonts are going to not be happy in the slightest with redistribution through application embedding. So unless you’re absolutely 100% sure that the IP lawyersharks aren’t going to hunt you down and feed on your entrails for unauthorized distribution of commercial fonts that you have bought, it behooves you greatly to only use fonts with freely redistributable license terms. Which we believe that you’ll find in abundance — or at least here and there — at these sites:
- dafont.com (the source of the particular font in question here)
- WebpageFonts.com
- AbstractFonts.com
- ClipArt.com
- Larabie Fonts
- The Devil In Jason Ramirez (love that Cocaine Nosejob)
- TeaBeer Studios (you can’t get more cool than an Adam Warren font!)
- 88 Professional Fonts for your Web Sites And Designs
- TheFreeSite.com
- Top 20 Sites To Download Free Fonts
Any other sources of license-unencumbered embeddable fonts you care to recommend, Dear Readers?


Nice article!
Hey, thanks for writing this up! This will help me out a lot. Love your writing style and the blog was easy on my eyes. Cheers!
Dude VERY nice link. Thanks a lot! Worked like a charm.
How would you make the text clickable? Tried with subviewing a fontlabel into a uibutton to with no success.
Well, the FontLabel class is simply a strangely drawing UILabel, so you’ve got a couple options:
1) Add tap handling and fake buttonish drawing to UILabel
2) Add a FontLabel as a subview (or grouped with) a blank titled UIButton.
Whichever is more expeditious for exactly how you want your semi-custom interface to look. I suspect if I was using custom fonts for anything other than the big “scoreboard” display this was for, I’d probably have custom button state images as well, so I’d draw them myself in my FontButton subclass of FontLabel and add tap handling/state tracking. If for some reason that was impractical, then on to 2), figuring out some view nesting arrangement that works.
Yes. I guess 3) would be the better, more future-proof option. I will look into those classes and see how extensible they are. FWIW, this is the code I am using (just a big button with a fontlabel inside):
[code]
- (void)viewDidLoad {
[super viewDidLoad];
FontLabel *btn = [[FontLabel alloc] initWithFrame:CGRectMake(0, 0, 320,480) fontName:@"Stonehenge" pointSize:28.0];
btn.textColor = [UIColor whiteColor];
btn.text = @"click me";
[btn sizeToFit];
btn.backgroundColor = [UIColor blackColor];
btn.opaque = YES;
UIButton *theButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
theButton.opaque = YES;
[theButton addTarget:self action:@selector(goPlay) forControlEvents:UIControlEventTouchUpInside];
[theButton addSubview:btn];
[self.view addSubview:theButton];
[btn release];
[theButton release];
}
- (void)goPlay {
NSLog(@"hello");
}
[/code]
I get an EXC_BAD_ACCESS error.
Ok I finally made it work with subviewing the FontLabel inside a UIButton.
Thanks for taking the time to write it .Nice collection of fonts.I am always looking for new fonts to spice up my designs.Huge thanks.
Nice list you got there. Great job! Especially Larabie Fonts is good!