Can't properly load custom font in Android

Hello :slight_smile:

So I’ve read a lot of topics, articles and stuff about it. Most ppl have problem with font don’t working on simulator, but I have problem with running it in app on phone. I have Samsung Galaxy Core, font Venice Classic. It’s in main folder (with main.lua). I even tried to put it in ‘Resources’ folders in program files. I have no more
ideas…

Here pics that I did all I’ve read about:

http://s6.ifotos.pl/img/mainpng_erppqqw.png

Works in simulator:
http://s4.ifotos.pl/img/simpng_erppqqs.png

Can you help?
 

Read this tutorial:

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

Rob

Dear Rob,

I am trying to also implement a custom font, called “Source Sans Pro”. This was shown in the native.getFontNames().

I have read the tutorial, and did all the steps. The custom font failed to show in my Windows-simulator. No error was shown in the logs. Using simulator 2014.2189.

Any ideas what I am doing wrong ?

Thanks

yosu, you have to have the font installed on windows for it to show in the simulator (same on Apple) just open the zip and double click the font and when it opens up click on t he “install” button then reload the simulator :slight_smile:

The fonts are already installed.

If it isn’t installed, it won’t appear in the font list of 'native.getFontNames() '.

Weird I downloaded your font put it in my app directory and it loaded right up.

For it to show in the simulator, it has to be installed in to Windows (and OS-X for Mac users).  For Android you just have to have it in the folder with your main.lua.  On iOS it has to be in the build.settings file.

Then you have to reference the file by it’s internal name (which on Android should be the same as the filename).

@christopher, most likely the font has been installed on your system. Some software like Adobe might have used it.

Yes, the font has been installed on the Windows,  but the font (in Win Simulator) still does not appear. The font’s name used in corona is “Source Sans Pro”. No warning/error appears when I use it. The text just doesn’t show up.

On an Android device , the text shows nicely. No problems.

When I  tested the same code in Mac simulator (already installed the font on the Mac), the text shows nicely. No problems.

Here is my code snippet :

if "Win" == system.getInfo( "platformName" ) then DEFAULT\_FONT\_BOLD = "Source Sans Pro" elseif "Android" == system.getInfo( "platformName" ) then DEFAULT\_FONT\_BOLD = "SourceSansPro-Bold" else -- Mac and iOS DEFAULT\_FONT\_BOLD = "SourceSansPro-Bold" end

Read this tutorial:

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

Rob

Dear Rob,

I am trying to also implement a custom font, called “Source Sans Pro”. This was shown in the native.getFontNames().

I have read the tutorial, and did all the steps. The custom font failed to show in my Windows-simulator. No error was shown in the logs. Using simulator 2014.2189.

Any ideas what I am doing wrong ?

Thanks

yosu, you have to have the font installed on windows for it to show in the simulator (same on Apple) just open the zip and double click the font and when it opens up click on t he “install” button then reload the simulator :slight_smile:

The fonts are already installed.

If it isn’t installed, it won’t appear in the font list of 'native.getFontNames() '.

Weird I downloaded your font put it in my app directory and it loaded right up.

For it to show in the simulator, it has to be installed in to Windows (and OS-X for Mac users).  For Android you just have to have it in the folder with your main.lua.  On iOS it has to be in the build.settings file.

Then you have to reference the file by it’s internal name (which on Android should be the same as the filename).

@christopher, most likely the font has been installed on your system. Some software like Adobe might have used it.

Yes, the font has been installed on the Windows,  but the font (in Win Simulator) still does not appear. The font’s name used in corona is “Source Sans Pro”. No warning/error appears when I use it. The text just doesn’t show up.

On an Android device , the text shows nicely. No problems.

When I  tested the same code in Mac simulator (already installed the font on the Mac), the text shows nicely. No problems.

Here is my code snippet :

if "Win" == system.getInfo( "platformName" ) then DEFAULT\_FONT\_BOLD = "Source Sans Pro" elseif "Android" == system.getInfo( "platformName" ) then DEFAULT\_FONT\_BOLD = "SourceSansPro-Bold" else -- Mac and iOS DEFAULT\_FONT\_BOLD = "SourceSansPro-Bold" end

What everyone has missed here is that the font is an open type font.

I installed an otf font on my Windows system, ran some code to find the proper name of the font, restarted the simulator, re-uploaded the apk, basically wasted hours only to find out by reading a blog that it is not supported on Windows only, is this still the case? I have a font I really want to use and having it work on the device but not in the simulator is a major pain in the butt.

What everyone has missed here is that the font is an open type font.

I installed an otf font on my Windows system, ran some code to find the proper name of the font, restarted the simulator, re-uploaded the apk, basically wasted hours only to find out by reading a blog that it is not supported on Windows only, is this still the case? I have a font I really want to use and having it work on the device but not in the simulator is a major pain in the butt.