Custom Fonts for Android app

Hey guys,

I’m having some custom font issues and so any help to solve this would be much appreciated. Using the tutorial link below I have not been able to get my custom font to show up in my scene. From what I gathered all I need to do is install the font into the ‘resource directory’ and call it in the ‘display.newText()’ line by its file name. I tried both the with and without the extension as well as  the font name. Nothing happens.It works fine in the simulator when I call it by its font name using windows/fonts but if I want to use it locally from my resource directory and also using the file name as directed in the link below(ex. PTF55F.ttf),  nothing happens. I just get the default font. I am also wondering if I am misunderstanding the location of the ‘resource directory’. Is the 'resource directory where the ‘main’ file lives or is it the sandbox? I need to be able to do this so this font can be compiled so when installed into an android system the font will be visible.

http://coronalabs.com/blog/2013/01/16/faq-wednesday-custom-fonts/

Thanks,

Gil

I’ve moved this to the General discussion forum as it’s not related to Advanced Graphics.

You need to use the internal name of the font.  You might have a font named: billybob.ttf

But internally, its named BillyBob-Regular

There seems to be some magic needed on Android and the best practice is to make sure the file name matches the internal font name.  In this example, I would rename the font file to be BillyBob-Regular.ttf.  Keep in mind the devices are case sensitive too.

Rob

It worked!!! Thanks! I even set it up to switch if in simulator. Thanks!!

Just a side note… The speedy reply was awesome! Much appreciated!

Quite welcome!

I’ve moved this to the General discussion forum as it’s not related to Advanced Graphics.

You need to use the internal name of the font.  You might have a font named: billybob.ttf

But internally, its named BillyBob-Regular

There seems to be some magic needed on Android and the best practice is to make sure the file name matches the internal font name.  In this example, I would rename the font file to be BillyBob-Regular.ttf.  Keep in mind the devices are case sensitive too.

Rob

It worked!!! Thanks! I even set it up to switch if in simulator. Thanks!!

Just a side note… The speedy reply was awesome! Much appreciated!

Quite welcome!