Trouble witt Custom Fonts

Hey,

I added in build.settings a custom font, tried it on my texts in corona simulator and it worked fine.

Once I built for iOS, my texts disappeared both in xcode simulator and iPad.

This is my code, and the file is in my app folder (not a subfolder)

settings = {  
 iphone = {  
 plist = {  
 UIAppFonts = {  
 "akaFrivolity.ttf"  
 }  
 },  
 },  
}   

Any thoughts?

Thanks [import]uid: 95495 topic_id: 17737 reply_id: 317737[/import]

Sometimes there is a difference between the font name in the text line itself and the build.settings file.

For example:

From my project code:

local risingscore = display.newText( "+" .. ( 10 \* holder.health), storex, storey, "Extrafine", 40 )  

So Extrafine is the font name.

From the build.settings file:

settings =  
{  
 iphone =  
 {  
 plist =  
 {  
 UIAppFonts =   
 {  
  
 "Extrafine.ttf"  
 },  
  
 },  
 },  
}  

Extrafine.ttf is the file name.

The difference being the inclusion of the file extension. Some fonts even have completely different names between the two. If you pull the font up in illustrator or potentially word that name often differs from the file name. [import]uid: 10903 topic_id: 17737 reply_id: 67589[/import]

Yeah mine is just akaFrivolity, without the file extension, but it was already correct!

What bugs me is that it works perfectly in Corona and it disappears in xcode… [import]uid: 95495 topic_id: 17737 reply_id: 67590[/import]

If you’re on a Mac, you can double-click the font (assuming the default app for fonts on your system is FontBook), then when the small window comes up, look at the titlebar. The actual font “name” will be there (not the filename).

Hope that helps!

Also, take a look at this guide to ensure you’re not missing any steps:

http://blog.anscamobile.com/2011/07/custom-fonts-corona/ [import]uid: 52430 topic_id: 17737 reply_id: 67592[/import]

Hey Jonathan,

It all looks good with the code, it works in Corona. The file is there, and the actual name of the font is being used in my code!

It’s like it didn’t build for my iOS test together with the rest of the folder! [import]uid: 95495 topic_id: 17737 reply_id: 67601[/import]

Sometimes specific fonts behave funny (for whatever reason) … try using a different custom font to see if you’re still getting the issue. If you replace the font, the filename in your build.settings, and the name within your code and it all works, then it’s likely an issue with the font you’re trying to use. [import]uid: 52430 topic_id: 17737 reply_id: 67615[/import]

Also is the name of the font akaFrivolity.ttf with the uppercase f? The syntax needs to be the same. [import]uid: 10903 topic_id: 17737 reply_id: 67618[/import]

Yeah it is…this typos or misplaced files would all turn up with corona simulator i’m guessing…it doesn’t make sense!
i’ll try with another one and i’ll get back to you
tks [import]uid: 95495 topic_id: 17737 reply_id: 67619[/import]

They actually wouldn’t if it’s an issue in build.settings. [import]uid: 10903 topic_id: 17737 reply_id: 67621[/import]

Yeah I rechecked everything, tried with another font…nothing worked!!! [import]uid: 95495 topic_id: 17737 reply_id: 67632[/import]

Can you zip your file and upload it to github then link it? [import]uid: 10903 topic_id: 17737 reply_id: 67633[/import]

Hi Gustavoschv,

Check out this tutorial video. It makes custom fonts a breeze!

http://www.youtube.com/watch?v=Y6r2V4Nd2Vw

Good luck :slight_smile:

Regards,
Jordan Schuetz
Ninja Pig Studios [import]uid: 29181 topic_id: 17737 reply_id: 67647[/import]

I am having this exact same issue as well… I’ve checked all the tutorials and they are all showing the fonts loading successfully in the Corona Simulator but what they aren’t showing is that the fonts won’t render in the xcode simulator or on an actual device.

My font is OTF and installed on my mac and I’m using the correct ACTUAL name of the font (again, it’s showing up correctly in the corona simulator).

Is this some type of bug? [import]uid: 47361 topic_id: 17737 reply_id: 67829[/import]

Sorry! I accidentally submitted my response twice… [import]uid: 47361 topic_id: 17737 reply_id: 67830[/import]

I tried everything, new fonts, otf, ttf…it just disappeared. (still working in corona simulator)

When I tried changing to native.systemFont it worked everywhere. It’s a little bit uglier but i’m done with it…

If someone figures it out let me know! [import]uid: 95495 topic_id: 17737 reply_id: 67832[/import]

Can either of you upload a project file to checkout? (Or just a sample with text not working, not the whole project?)

What version of Corona are you currently using? (Either or both of you.)

Peach :slight_smile: [import]uid: 52491 topic_id: 17737 reply_id: 67882[/import]

I am running the latest stable build of corona (2011.8.2).

I have my sample work zipped and ready to upload but I’m not sure how to go about doing that… Is there a forum tool for uploading project files that I’m not seeing? [import]uid: 47361 topic_id: 17737 reply_id: 67972[/import]

Woohoo! I figured it out! Don’t give up quite yet, gustavoschv :slight_smile:
I was originally trying to figure out the EXACT name of the font by clicking on the font in FontBook.

DON’T DO THIS!

Instead, use native.getFontNames()
Use the example code found here: http://developer.anscamobile.com/reference/index/nativegetfontnames

Switch out the “Times” found in line six to whatever font family you’re using (in my case it was Katarine) and it will spit out all the correct names for that font in the terminal! The font names that printed out in the terminal were ever so slightly different than what I was grabbing from Font Book and apparently that’s all it took…

Now all fonts are showing up beautifully across all platforms! So excited.

Good luck [import]uid: 47361 topic_id: 17737 reply_id: 67983[/import]

Hey, this didn’t work for me either. All my names are exactly the same, ttf or without it! But it’s a small part, doesn’t seem so important to lose more time with this, but thanks!

Peach, I posted some questions on your facebook and rate button tutorials, pleease answer it when you get a chance!!

Appreciate it, thanks for the help anyways! [import]uid: 95495 topic_id: 17737 reply_id: 68030[/import]

rarmstrong, am pleased your issue is now resolved - some good tips :slight_smile:

Gustav, I’ve responded to your questions on Techority.

Peach :slight_smile: [import]uid: 52491 topic_id: 17737 reply_id: 68072[/import]