This is not a question but some useful information on getting custom fonts working (SDK 1.7.1). There is a very good video on the topic posted here, but for those not wanting to sit through a video and just get the rundown on the steps which need taking, as well as some further information worked out in the process:
You just copy the font file into your project directory under
Resources/fonts. You then set the
font.fontFamily property of a control to the filename of the font file (case sensitive), minus the extension. Note that Android's fonts don't seem to like spaces in the filename, and won't work if present.
You can put the font file anywhere (but naturally, you'd put it in the same place as on Android :p). The trick is getting it registered.
- Build your app for iPhone/iPad to generate some files
- copy info.plist from
build/iphone/to the root of your project folder (in the same folder as
- open up the plist file, and add a new key
UIAppFonts. Make it an array value.
- Add any fonts you want imported under this key, storing the full path to the font file, relative to your project's
Resourcesfolder. Using the Android-safe location, this would be
fonts/myFontFile.ttf. Remember that the font paths are case-sensitive.
font.fontFamilyproperty to the font name of the font.
- Delete everything in your
build/iphonefolder (you only need to do this each time you edit the
- Compile and run!
As you can see, the font family values you must specify are different for iOS and Android. You could either conditionally code them, or just name the font file the same as its internal font name. But of course, you won't be able to rename the font file like this if the font name has spaces in it!
If you edit Info.plist directly, you must put /fonts/myFontFile.ttf instead of fonts/myFontFile.ttf to get it working
Think you can help? Login to answer this question!