[SOLVED] Custom fonts are making me sad

Hi all!

So, I'm having problems using custom fonts—as in, they don't work. In the game I'm working on, if I try to embed a custom font and use it, they font shows up REEEALLY small in the simulator, but then doesn't show up at all on the device. If I make a brand new project, and do the custom font example that's in the docs (downloading the font file from the included link), the text shows up, but not with the Harrowprint font.

My settings file is set up properly, and I've tried several .ttf and .otf files. Is there some silly little secret that I'm missing?

Thanks!

do you have the font installed on your computer and a copy of it in your folder with the main.lua file

I didn't have it installed, but now I do. And that solves the issue of the font not displaying in the simulator, but it still doesn't show up on the device.

Logan

a copy of the font file needs to be in the folder with main.lua also

Yep, I have the copy of the font file in the same folder.

Did you include it in the build.settings? See this blog post for a guide on using custom fonts:

http://blog.anscamobile.com/2011/07/custom-fonts-corona/

Also note that on Android, the actual font name must be used (see the blog post for more details).

Hi, yep! I definitely have it in the build.settings file...I followed the blog post to the letter. Is there some subtle formatting thing that I'm missing? My build.settings file looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
settings =
{
        orientation =
        {
                default ="landscapeRight",
                content = "landscapeRight",
                supported =
                {
                        "landscapeRight"
                },
        },
        plist =
                {
                                UIApplicationExitsOnSuspend = false,
                                UIAppFonts = {"Harrowprint.ttf"}
                },
}

(I'm doing this for iOS, by the way.)

I found your problem.

The 'plist' table should be within the 'iphone' table, so yours should look like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
settings =
{
    orientation =
    {
        default ="landscapeRight",
        content = "landscapeRight",
        supported =
        {
            "landscapeRight"
        },
    },
        
    iphone =
    {
        plist =
        {
            UIApplicationExitsOnSuspend = false,
            UIAppFonts = {"Harrowprint.ttf"}
        }
    }
}

That fixed it! Thanks so much! :-D

views:1782 update:2011/11/14 9:16:56
corona forums © 2003-2011