How to Use Custom Font?

Yes, I just tried 3rd font with the same result.

What’s also weird is that often (maybe 50%?) of the time the build doesn’t show up on the device, although Corona tells me it’s been copied over and no errors are generated. Not sure if this is a different problem, or part of the same thing.

This is what the console log looks like when it doesn’t actually copy:

Jul 25 06:49:58.658 Installing ‘Robotronish.app’ on Jay’s_iPad_mini …

Jul 25 06:49:58.658 ----------  Device Log Starts  ----------

Jul 25 06:50:04.076 Exiting…

Jul 25 06:50:04.076 Exiting…

Jul 25 06:50:04.076 ---------- Device Log Finished ----------

Should there be more stuff in there?

 Jay

I don’t remember if fonts are loaded but maybe not.
Just had a thought can you post your build.settings

settings = { orientation = { default ="portrait", content = "portrait", supported = { "portrait","portraitUpsideDown" }, }, iphone = { plist = { UIApplicationExitsOnSuspend = false, UIPrerenderedIcon = true, UIStatusBarHidden = true }, }, }

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

http://gamedevnation.com/files/WhattheShell.zip

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! :wink:

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. :wink:

 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. :slight_smile:

 Jay