Can't get fonts to show up on iOS

Hey guys, was wondering if anyone knows why I could be having issues with a custom font showing up on iOS (specifically iPad 3). 

I’ve followed all the directions here http://www.coronalabs.com/blog/2013/01/16/faq-wednesday-custom-fonts/ and I can’t figure out what the issue here. 

I’ve added the font file in the root folder, added it into the build.settings file and in the code I am referencing it by it’s name (not the file name). I have no issues in the simulator, but it just flat out doesn’t show up at all on the device. Any ideas? Thanks!

Hi @fady.sadeq,

Since it appears that you’ve followed the correct steps outlined in the doc, this could be an issue with the particular font. Out of curiosity, can you try a different font and see if the same behavior occurs?

Sincerely,

Brent Sorrentino

Thanks for the reply. I tried it with another font, and I’m having the same issue, so surely I’m doing something incorrectly. Does the location of the font file matter? 

Had problem with fonts on iOS even following instructions. It appears that looking at font name and file name it doesn’t map to name used by Corona. The best is to print all fonts on device and check proper name of font.

Did you carefully confirm that you matched the case-sensitive file name in the build.settings?

Yep. 

Let’s have a look at your build.settings please. :slight_smile:

settings = { orientation = { default = "landscapeLeft", supported = { "landscapeLeft", "landscapeRight" } }, iphone = { plist = { UIStatusBarHidden = true, UIPrerenderedIcon = true, -- set to false for "shine" overlay CFBundleIconFile = "Icon.png", CFBundleIconFiles = { "Icon.png" , "Icon@2x.png" , "Icon-72.png" }, UIAppFonts = { "GothamRounded-Light.otf", "AvenirLTCom-Light.ttf" } --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend --[[-- iOS app URL schemes: CFBundleURLTypes = { { CFBundleURLSchemes = { "fbXXXXXXXXXXXXXX", -- example scheme for facebook "coronasdkapp", -- example second scheme } } } --]] } } --[[-- Android permissions androidPermissions = { "android.permission.INTERNET", },]]-- }

Hmm, maybe this is it then? I’m on OSX and doing a get info on the font to get the name. Works in simulator, but I guess maybe it’s not the “true” name. 

My example. I had Open Sans Light Italic font. File was OpenSans-LightItalic.ttf and name in properties was Open Sans Light Italic. I was scratching my head why it didn’t work. I printed all fonts and found that name used by Corona (on device) was not “Open Sans Light Italic” as in instructions but “OpenSansLight-Italic” and after applying  it everything worked as charm.

Interesting. How did you print out the fonts on device? I’m using the method found here http://www.coronalabs.com/blog/2013/01/16/faq-wednesday-custom-fonts/ but I can only trace it out in the simulator.

I you are on mac then you have iphone utility. There is console for debugging apps.

So I got the iphone utility working and can view the console from the device. It says the font count is 165, but only prints out a handful. How can I view all the fonts? Strange. 

Sep 26 19:09:41 \<Warning\>: Font count = 165 Sep 26 19:09:41 \<Warning\>: fontname = Optima-ExtraBlack Sep 26 19:09:41 \<Warning\>: fontname = Optima-Italic Sep 26 19:09:41 \<Warning\>: fontname = Optima-Regular Sep 26 19:09:41 \<Warning\>: fontname = Optima-BoldItalic Sep 26 19:09:41 \<Warning\>: fontname = Optima-Bold
local fonts = native.getFontNames() for k, v in ipairs(fonts) do print(k, v) end

On tutorial page is method to select from all fonts only selected ones which contains searched part of name.

Yup, just did that myself :slight_smile: I FINALLY HAVE THE ELUSIVE FONT NAME! Works now. Thanks!

I was fighting with it for few days alone recently  :smiley: Good to hear it helped (good timing).

Hi @fady.sadeq,

Since it appears that you’ve followed the correct steps outlined in the doc, this could be an issue with the particular font. Out of curiosity, can you try a different font and see if the same behavior occurs?

Sincerely,

Brent Sorrentino

Thanks for the reply. I tried it with another font, and I’m having the same issue, so surely I’m doing something incorrectly. Does the location of the font file matter? 

Had problem with fonts on iOS even following instructions. It appears that looking at font name and file name it doesn’t map to name used by Corona. The best is to print all fonts on device and check proper name of font.