0

Following the instructions here, I'm trying to use custom fonts on my game. The custom font works okay in iOS device but not on the android device I'm testing on. I've made sure to include the font file (.ttf) on my project folder and I'm using this to set the font:

if(system.getInfo("platformName") == "Android") then
    label = display.newText("text", 100, 100, customfonthere, 38)
end

However, when I run the game on the device, the custom font doesn't work. Is there something I might be missing here? I've also tried the font name with and without the file extension.

UPDATE: Actually, never mind. I guess my font file was damaged somehow. I just deleted it on the project folder and copied it from one of my backup files.

user1597438
  • 2,171
  • 5
  • 35
  • 78

1 Answers1

3

For everyone else who encounter problems with using custom fonts in Corona, try deleting the font file and redownloading it from wherever you got the font file or if you have a backup of the font file somewhere, just copy it back to your project folder. My font file was damaged so when I deleted it and added it again, it worked.

Follow the instructions from here. If the font doesn't show on your simulator, don't panic like I did. It simply means the font isn't installed in your workstation but rest assured, it will work on the device.

Then just use the font like you would use any system fonts in corona. You don't have to put the file extension (ttf or otf) for android devices. At least that's how it is for mine.

user1597438
  • 2,171
  • 5
  • 35
  • 78
  • 1
    This blog article has some good info on fonts in Corona SDK http://www.coronalabs.com/blog/2013/01/16/faq-wednesday-custom-fonts ... also bear in mind that some fonts work on some platforms but not on others; Windows is particularly picky and just because the correct font is not shown in the Windows Simulator doesn't mean it wont work just fine on the Android device. – Perry Mar 24 '13 at 00:03