Custom fonts wont work

Hello. I want to add custom font to my game. In my game folder is file “Fixed.ttf”, and here is part of my code:

score = display.newText("Score: " .. count, display.contentWidth/2, 30\*baseY, "Fixed", 30\*baseX + adsHeight)

And my console returns error, font are not working on my phone, so i guess it the same issue.

Which device type(Android or iOS).  Also, for the best help on this kind of problem,  you should:

  1. Share the font with us so we can try it

OR (better)

  1. Make a small project demonstrating the problem and including the font.  Again, so we can try it.

Either way post it to dropbox or some other file sharing network.

I say this, because solving font issues is notoriously difficult w/o seeing the font and the code.  

(There are a lot of free fonts out there that just don’t work well universally.)

-Ed

https://www.dropbox.com/s/jb0h1fxfhf8yb6h/main.zip?dl=0 It’s only font and main :wink: rest can be made by few clicks. I’m on mobile now, so it would take hours to upload empty project with generic images.

Only Android and Windows can load a font by file name.

On iOS and OS X, your only option is to load the font by its “Font Family Name”.

Have a look here…

   https://docs.coronalabs.com/daily/guide/system/customFont/index.html

I’m working on Windows, and my debug device is Android. I forgot to write this in previous post, sorry.

If Windows is unable to load the font by file name, then there may be something wrong with the font file.  What happens when double click on the font file on Windows?  Does it show the font viewer?

** UPDATE Looks like were were typing at the same time.  Thanks for answering, but I need to know a little more **

I just ran this with Corona 2015.2716 and it worked fine for:

  • Corona Simulator Running on Windows 10 system.
  • Android 4.4.4 Running on Generation 1 Nexus 7

I need some more info…

Tell us a little more about your dev system and test devices:

  • Corona Version your using
  • Development System Windows or Mac
  • Development OS Version
  • Test Device(s)
  • Test OS(s) and Version Numbers

Thanks,

Ed

PS - I’d also run the sample you sent us yourself and see if that works.  If your sample works for you and your game doesn’t then something else is going on.

Which device type(Android or iOS).  Also, for the best help on this kind of problem,  you should:

  1. Share the font with us so we can try it

OR (better)

  1. Make a small project demonstrating the problem and including the font.  Again, so we can try it.

Either way post it to dropbox or some other file sharing network.

I say this, because solving font issues is notoriously difficult w/o seeing the font and the code.  

(There are a lot of free fonts out there that just don’t work well universally.)

-Ed

https://www.dropbox.com/s/jb0h1fxfhf8yb6h/main.zip?dl=0 It’s only font and main :wink: rest can be made by few clicks. I’m on mobile now, so it would take hours to upload empty project with generic images.

Only Android and Windows can load a font by file name.

On iOS and OS X, your only option is to load the font by its “Font Family Name”.

Have a look here…

   https://docs.coronalabs.com/daily/guide/system/customFont/index.html

I’m working on Windows, and my debug device is Android. I forgot to write this in previous post, sorry.

If Windows is unable to load the font by file name, then there may be something wrong with the font file.  What happens when double click on the font file on Windows?  Does it show the font viewer?

** UPDATE Looks like were were typing at the same time.  Thanks for answering, but I need to know a little more **

I just ran this with Corona 2015.2716 and it worked fine for:

  • Corona Simulator Running on Windows 10 system.
  • Android 4.4.4 Running on Generation 1 Nexus 7

I need some more info…

Tell us a little more about your dev system and test devices:

  • Corona Version your using
  • Development System Windows or Mac
  • Development OS Version
  • Test Device(s)
  • Test OS(s) and Version Numbers

Thanks,

Ed

PS - I’d also run the sample you sent us yourself and see if that works.  If your sample works for you and your game doesn’t then something else is going on.