Problem with custom font

Hi guys!

I can’t use my custom font.

This is my code:

local aaa = display.newText( "Hello World!", 100, 200, "SouciSansNF.ttf", 40 ) scrollView:insert(aaa)

The file SouciSansNF.ttf is in the root of my app, with main.lua.

I can see “Hello world” but is too small and it seems that font is not working properly.

I tried with 2/3 fonts but nothing has changed.

I’m still working on the emulator.

What can i do?

Thanks a lot

Remove the “.ttf”.

It works!

Thanks!

This syntax works even on the device?

Is it possible to use a custom font in a button ?

Yes. You don’t need the fonts extension.

Yes it’s possible to use custom font on a button.

Find “basic visual options” on this page.

https://docs.coronalabs.com/api/library/widget/newButton.html

What version of Corona SDK are you using?

Are you on a Mac or PC.

We have made it so that you just use the filename (including the .ttf) to access custom fonts.

Rob

On emulator it works correctly but on the real device the font is not working and the standard one is displaying.

What i have to do?

I’m working on Mac and I’m testing on an android.

My Corona version is: Version 2015.2731 (2015.10.5)

Currently my font ss on the main.lua folder and i’m using this syntax:

local aaa = display.newText( “Hello World!”, 100, 200, “SouciSansNF.ttf”, 40 )
scrollView:insert(aaa)

Device’s are case sensitive.  Are you sure your font is really named SouciSansNF.ttf (same upper and lower case letters?)

Remove the “.ttf”.

It works!

Thanks!

This syntax works even on the device?

Is it possible to use a custom font in a button ?

Yes. You don’t need the fonts extension.

Yes it’s possible to use custom font on a button.

Find “basic visual options” on this page.

https://docs.coronalabs.com/api/library/widget/newButton.html

What version of Corona SDK are you using?

Are you on a Mac or PC.

We have made it so that you just use the filename (including the .ttf) to access custom fonts.

Rob

On emulator it works correctly but on the real device the font is not working and the standard one is displaying.

What i have to do?

I’m working on Mac and I’m testing on an android.

My Corona version is: Version 2015.2731 (2015.10.5)

Currently my font ss on the main.lua folder and i’m using this syntax:

local aaa = display.newText( “Hello World!”, 100, 200, “SouciSansNF.ttf”, 40 )
scrollView:insert(aaa)

Device’s are case sensitive.  Are you sure your font is really named SouciSansNF.ttf (same upper and lower case letters?)