Question

I just tried everthing on the forums but I couldn't add my custom font to system. Here's what I have done:

I made sure that family name and font name are same with Typelight program.

enter image description here

Then I just change the name of the file in the root directory and drag it to Outlaw. After that write the filename in display.newText.

enter image description here

Can you tell me where I am doing wrong?

[EDIT] Well, the problem was that I haven't installed the font with Windows Font Viewer. After installing it with WFV and removing the extension from font parameter thx krs, I finally displayed the text with customized font =) YAY!

Was it helpful?

Solution

Once you have your font file handy (ex. Harrowprint.ttf), you’ll need to first place it in your project directory (the same place your main.lua resides).

For Android apps, nothing needs to be done apart from including the font in your project folder.

There is an edit you have to do in your code as follows :

 local textObject = display.newText( "See my new font?", 100, 100, "Harrowprint", 40 ) -- no need to use extension here

If it doesn't works again then , you just use a font file with '.ttf' extension. This may work.

Courtesy : http://www.coronalabs.com/blog/2011/07/13/custom-fonts-corona/

OTHER TIPS

If you are not seeing it in the Simulator, its likely you have not installed the font in Windows.

Then you are not using the right name in your code. You don't use the .otf or .ttf inside Corona.

local textObject = display.newText( "Hello World", 100, 100, "Alex Brush", 40 )

Next, if you're building for Android, depending on the build, OTF fonts may not supported. I think OTF support was added with one of the recent daily builds, but I don't believe the last public build supports OTF.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top