Ok never mind, i always delete the app on my device before I build. I have never experienced any like this when buld for iOS.
Just rebuilt another game using a custom font and it worked fine on the device – copied that font to the new project and set it as mainFont in my main.lua and did a build – and it doesn’t work on the device.
So something(?) in my new project is blocking custom fonts from working?
I’m going to start ripping things out and see what happens…
Below is a link to the project that consists of a main and menu (composer scene file). Main goes straight to menu and there’s a button that should say “Play” using the included custom font. But on my devices and the Xcode simulator all I see are squares with question marks. Works fine in Corona Simulator.
Any ideas?
Jay
The failing to copy the app on build does happen to me from time to time. It seems to happen more on my iPad than my iPhone. I think you’re the first one to report it in the forums, so it’s a bit more wide spread that something in my setup. I’ll see if I can repo it and catch the full log to send to an engineer.
I’ll look at the zip file too and see what’s up.
Rob
Also what device/OS version are you testing on?
What version of Xcode is installed?
What version of macOS are you running?
Thanks
Rob
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?
Finally I noticed this in my log file:
Jul 26 10:56:33.548 Activated fonts in ‘Robotron.ttf’ (Robotron)
Jul 26 10:56:33.593 Copyright © 2009-2016 C o r o n a L a b s I n c .
Version: 3.0.0
Build: 2016.2906
Jul 26 10:56:33.621 Loading project from: /Volumes/Macintosh HD/Media/Downloads/What the Shell
Jul 26 10:56:33.622 Project sandbox folder: ~/Library/Application Support/Corona Simulator/What the Shell-BEA285BAA549719F01AEB0DF37AF1A03
Jul 26 10:56:33.657 Platform: iPhone / x86_64 / 10.11.5 / Intel HD Graphics 4000 OpenGL Engine / 2.1 INTEL-10.14.66 / 2016.2906 / en | US | en_US | en
Are you seeing that line?
Forgot to attach the files:
I just build the app for Mac OS and IPhone 6s works.
I just did a macOS build too and it worked as expected.
Okay, I’m using:
OS X 10.11.5
Xcode 7.3.1
iPad mini 2 9.3.2
iPhone 6 9.3.3
I got the “Activated” line when the app *didn’t* get copied to the device, but right now it’s copying every time and that line is not appearing.
I’ll try switching back to the “old fashioned” way and see what happens.
Jay
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!!!
Jay
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.
Jay
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.
Thanks
Rob
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.
Jay
The font *does* work fine the way I have it coded when I build for OSX, though. (I deleted it from my system fonts.)
OSX is not case sensitive , so that be it. Also it might just be the font, some fonts don’t work on certain devices.
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.
Jay
Ok i used corona 2912 and it worked fine. Attached a demo below along with an image it work on device and simulator.
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.
Thanks for your help, Scott.
Jay
Can you post the font you are using? You don’t have to if it is private or paid product.