I ran and built your test app on my iPad 4 with no changes. Here are the results:
Simulator (2906): worked (see 1st screen shot)
iPad 4 (iOS 9.3.2): worked (see 2nd screen shot)
So at this point since no fonts seem to work it has to be something local blocking it and I really have no clue what that might be… I’ll try to have a conversation with the engineers in a bit to see they have any ideas.
Does this font/method of loading work in other apps where you do have custom fonts work?
Can you do another test this time loading the font old school (include the UIAppFonts block in build.settings, load by Font Family name instead of file name) and see if that works?
This is the first project I’ve done since the new way was available. But I just switched to the new way in an older project and it freaking works. Argh!
I went back through that sample project and there’s almost nothing there – nothing that should cause problems at all. But even that little sample project will not show a custom font on a device. I’ve tried both the old and new ways with no luck on iOS…
…although it does work when installed on my Android device. Double argh!!!
I discovered the problem, and it looks like Corona Labs’ fault rather than mine!!! Woohoo!
When I did a build I chose “What the Shell?!” as the application name, but this evening I used that as the name of the build folder, I found Corona Simulator barfed on it. So then I changed the name of the folder and changed the build Application Name (took off the ?!) and now the custom fonts are showing in the game!
The folder problem happens with the question mark – don’t know if that’s the same for the custom font issue (or if it’s the exclamation point, or both) because it’s about 4AM and now that I found the problem I’ll leave it to a CL engineer to look further.
Can you file a bug report on this please? You will need a complete project (main.lua, config.lua, build.settings and any assets such as the fonts) that demonstrates the problem. Put that in a .zip file and use the Report a bug link at the top of the page.
It’s bug #46860 – and I bugged the other one separately because I figured they might actually be two different areas of the code, two different types of fixes, whatever. Just in case.
Okay, I tried the .otf version of the font and it didn’t work. so then I tried a completely different font – and it didn’t work, either.
The _ strange thing about that _ is I used the same font in my last game, which was done in Unity, and it works fine on the device, so I’m thinking it’s *not* the font that’s the problem.
I’m using it like this:
local mainFont = "BoogalooOne-Regular.ttf" -- and then later on... local dTxt = display.newText(txt, 0, 0, mainFont, 24)
The .ttf font file is in the root directory of the project and I can see from the console that it’s actually in the project:
Copying /Users/jay/Desktop/What the Shell/BoogalooOne-Regular.ttf to /Users/jay/Desktop/What the Shell?!.app/BoogalooOne-Regular.ttf
I’m using Corona v2016.2906 that I just downloaded today.
Hmmm…this is weird. Your test worked on my device. So I tried some things:
I updated to the daily build to make sure that wasn’t the problem.
Saw you were using Boogaloo-Regular instead of BoogalooOne-Regular, so I downloaded that. (Var in code changed to the new name.)
When that didn’t help I used the actual .otf file from your example.
None of those fixed the problem, I’m still getting squares with question marks. The device is an iPad mini 2 (Retina) and I’ve also tried my iPhone 6S with the same results. I completely delete the old app from the device before trying a new build. No errors in the build console.
At this point I assume it’s something dumb that I’m doing and just not seeing. I think I’ll go for a walk and come back with a bigger hammer.
I can, but there’s something else weird going on. I rebooted my machine (you know, because if that’s good enough for Windows, it’s good enough for Mac?) and started again, double-checking things first.
It looks like the Corona Simulator is “caching” stuff and not taking the new files for the build. Or something. After the build it’s telling me it can’t find the font, but that was from before I rebooted when I was just testing stuff – according to the source code the font name is correct (I misspelled the font name on purpose just to make sure it would default to system font – it did).
Plus, the build console is showing me a runtime error, but I never launched the app yet. In fact, the app doesn’t even show up on the device. That runtime error happened the last time I ran the app on the device.
So something strange is going on and I’m thinking it may not have anything to do with the font at all. (Although it only started happening when I put in the custom font.)
We added the ability across all platforms to use just the filename after the previous public build. But it’s in the current public build (2906).
Have you tried a different font just to make sure it’s not a problem with that particular font.
Fonts no longer have to be installed on the device to work in the simulator.
That it works in a macOS build but not a simulator run seems odd indeed. Again you probably should try a different font just to rule out problems with that font file. Even though we let you load by file name, we still have to get the font family name from the font itself (and you can still use font family names as well!) to render the font, so if there is something wonky internally…