1

Is it possible to load a font from disk and use it during run-time?

If so, how/where do you store the fonts on the iphone/ipod/ipad for your app to use?

(To be clear, I'm not talking about adding the font as a resource at design-time. I'm asking about a way to allow a user to select a font file during run-time, loading it, and making it available for use.)

wayneh
  • 4,393
  • 9
  • 35
  • 70

2 Answers2

0

You should put them (.ttf, .otf) into your info-plist under UIAppFonts then you can "use" them with setFont: withSize:

basvk
  • 4,437
  • 3
  • 29
  • 49
  • Perhaps I should rephrase my initial question, but I'm trying to load a font from disk at run time - how would I add it to my info-plist? – wayneh Feb 08 '12 at 15:24
0

You add your font as a resource, add it to your info.plist under Fonts provided by application (UIAppFonts) array, then use it as any embedded one.


Ok, in that case take a look at FontLabel project.

One thing though, looking through it's code - you can only get CGFontRef and with kind of voodoo work with it, no conversion between CGFontRef and UIFont really exists. See this question

Community
  • 1
  • 1
ksh
  • 1,894
  • 19
  • 20
  • Perhaps I should rephrase my initial question, but I'm trying to load a font from disk at run time - how would I add it to my info-plist? – wayneh Feb 08 '12 at 15:24