Custom Font working on Android, but not iOS devices

I have a custom font which is working on my Android devices.
In the simulator, or Android devices, when I print the native.getFontNames I see my custom font.

But on iOS devices (iPhone 4 and iPad) I do not see my font name in that list. So the font isn’t getting loaded there, somehow.

My config.lua looks like this:

settings =  
{  
 iphone =  
 {  
 plist =  
 {  
 UIAppFonts =  
 {  
 "Stone.ttf"  
 },  
 },  
 },  
}  

The internal name, when I open the .ttf file in windows, reads:
“Font Name: Stone”
“True Type Outlines”
What could I be doing wrong?

Also, what possible use is native.newFont()? I keep thinking I might need to use that one time to install the font to device, but nobody mentions it. [import]uid: 65996 topic_id: 15471 reply_id: 315471[/import]

What does get returned on iOS?

Also, is the font not showing up on iDevices? From your description I can’t tell.

Please let me know.

Peach :slight_smile: [import]uid: 52491 topic_id: 15471 reply_id: 57243[/import]

On iOS devices, I see no text at all. (where I am specifying the custom font - native.systemfont works fine.)

The font list returned on iOS was very long… Courier, Helvetica, lots of others I’m not recalling.

I thought that including the font file name correctly in config.lua would make that font available, and thus make it a listed font when I run the function to find available font names. [import]uid: 65996 topic_id: 15471 reply_id: 57292[/import]

You aren’t mistaken; that is how it should work.

There are a few fonts that iOS seems to take issue with, could you try a different custom font? [import]uid: 10144 topic_id: 15471 reply_id: 57373[/import]

Alright, I’ve continued to bash my head against this wall, but to no avail.

I’m now specifying 10 different custom fonts in my config.lua, including Harrowprint - the font used in the examples.

When I print out the list of installed fonts on my iOS device - none of those custom fonts are listed.

If I specify my text use one of the listed fonts (pre-installed on iOS) text shows up fine. Specifying a custom font I get nothing (which makes sense, if the custom fonts are not being installed.)

Everything works perfectly in the simulator, and on Android devices.

My test device is an iPad2, OS version 4.3.5 (8L1) [import]uid: 65996 topic_id: 15471 reply_id: 58540[/import]

Just noticed something which might be important…

I do not have a “build.settings” file. I have a “config.lua” file, quoted above. I see these two files used somewhat interchangeably, but perhaps they are not?

As a quick test, I saved a copy of my config.lua as “build.settings” - but that didn’t seem to have any effect. [import]uid: 65996 topic_id: 15471 reply_id: 58541[/import]

Hold the phone! I got it working!

Following this tutorial: http://www.youtube.com/watch?v=Y6r2V4Nd2Vw

I created a new file through XCode named build.settings, and put in my information there.

I’m not very Mac-savvy, but I couldn’t understand how I had two files with the same name in the same directory? But I deleted my copy, and using the new file my custom fonts are finally appearing.

I still REALLY want to know what the different is between build.settings and config.lua - I suspect that many people having this problem are running into this difficulty… [import]uid: 65996 topic_id: 15471 reply_id: 58542[/import]

Hey Simon,

*FYI:

- config.lua:

  • Several runtime properties can be specified in a config.lua file.

- build.settings:

Regards,
Rodrigo. [import]uid: 89165 topic_id: 15471 reply_id: 58547[/import]

Hey simon,

Ah, no - build.settings and config.lua are definitely NOT interchangeable and you certainly need both in your app.

Not having a build.settings file would explain why this wasn’t working; you didn’t have one so you never added your custom font to it.

Apologies, I didn’t notice in your original post you said “config” rather than “build” - I jumped into examining the code and took it to be build.settings. (As none of these things go in config.lua.)

Glad it’s sorted anyway :slight_smile:

Peach

PS - Difference between the two is that config.lua is only used to specify screen size and build.settings is for everything else. See here; http://developer.anscamobile.com/content/configuring-projects [import]uid: 52491 topic_id: 15471 reply_id: 58556[/import]

Peach, I appreciate the assistance. I would also STRONGLY suggest breaking the “configuring-projects” page of the API reference into two pages. The top says “Here’s everything you can do with config.lua” - and then in the middle it says “and here’s everything you can do with build.settings.”

But if you aren’t reading it like a book - if you’re just popping up and down to find the settings you want - it’s trivial to miss that and think that the entire list pertains to config.lua

I’ve been reading lots of (older) threads where people couldn’t get custom fonts working on iOS, and at least 30% of them appear to have the same mistaken impression I had. [import]uid: 65996 topic_id: 15471 reply_id: 58604[/import]

Hi Simon,

I will pass on your suggestion :slight_smile:

I think most people look at the SampleCode in their CoronaSDK folder when they are confused about set up, or they get started using tutorials - and in either of those cases they learn early on the differences between the two files.

I do see what you are saying though, yes - and I will pass it on :slight_smile:

Peach [import]uid: 52491 topic_id: 15471 reply_id: 58687[/import]