Custom fonts

Does anybody know how I can import a custom font?? I tried to declared name in build.settings and then tried to use it for score, but terminal gave me an error: could not load “name” font"… Am I doing this right?? [import]uid: 51459 topic_id: 18710 reply_id: 318710[/import]

There are tons of forum posts on this. Have you searched for them?

The basics are:

build.settings:

 UIAppFonts =  
 {  
 "actionj.ttf",  
 "SAF.otf",  
 },  

needs to be in your iphone { plist {} } block. The comma’s are important.

Then in your code, you don’t need to load the font, just use it.

myText = display.newText("my text", 0, 0, "Action Jackson", 32)  

The string “Action Jackson” is the proper font name, not the name of the file (actionj.ttf)
[import]uid: 19626 topic_id: 18710 reply_id: 71901[/import]

Thanks Rob I will give that a try!! [import]uid: 51459 topic_id: 18710 reply_id: 71903[/import]

Just a little bit more, the “proper font name” can be found by clicking on the font and waiting for the install window to pop up and reading the name in the top left corner. [import]uid: 46343 topic_id: 18710 reply_id: 71982[/import]

i need to add, that for fonts to work on Windows you must first install them to system [import]uid: 16142 topic_id: 18710 reply_id: 71984[/import]

Font families only work on Mac. Not on Windows simulator.

As in “Arial” will work on both
“Arial Bold” will work on OSX, but not Windows.
“Arial Rounded MT Bold” will work on both.

It’s not the font name, it’s if the font has multiple files for each style of the font (bold, italics, etc.)

[import]uid: 13784 topic_id: 18710 reply_id: 119950[/import]

One more hint - a lot of TTF fonts out there will not work with Corona for some weird reason. I found that running the ttf file through something like font squirrel.com usually deals with that problem. [import]uid: 160496 topic_id: 18710 reply_id: 119951[/import]

You may find Andrew Burch’s demo app useful in your explorations:
http://www.newhighscore.net/?p=384

His demo won’t answer the question of ‘how to install and use’ custom fonts, but once you do get that worked out, it is a nice framework for testing them.

[import]uid: 110228 topic_id: 18710 reply_id: 119982[/import]

To Mike’s point, if you change the name of the fonts so that windows does not see them as a font family, the name will be the same in Corona for both Windows & OSX [import]uid: 13784 topic_id: 18710 reply_id: 119983[/import]

Font families only work on Mac. Not on Windows simulator.

As in “Arial” will work on both
“Arial Bold” will work on OSX, but not Windows.
“Arial Rounded MT Bold” will work on both.

It’s not the font name, it’s if the font has multiple files for each style of the font (bold, italics, etc.)

[import]uid: 13784 topic_id: 18710 reply_id: 119950[/import]

One more hint - a lot of TTF fonts out there will not work with Corona for some weird reason. I found that running the ttf file through something like font squirrel.com usually deals with that problem. [import]uid: 160496 topic_id: 18710 reply_id: 119951[/import]

You may find Andrew Burch’s demo app useful in your explorations:
http://www.newhighscore.net/?p=384

His demo won’t answer the question of ‘how to install and use’ custom fonts, but once you do get that worked out, it is a nice framework for testing them.

[import]uid: 110228 topic_id: 18710 reply_id: 119982[/import]

To Mike’s point, if you change the name of the fonts so that windows does not see them as a font family, the name will be the same in Corona for both Windows & OSX [import]uid: 13784 topic_id: 18710 reply_id: 119983[/import]