Android Custom Fonts

I have read through a few topics on the API and forums about custom fonts and android.

I have the following which works fine on Apple devices:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
settings =
{
        orientation =
        {
                default = "landscapeRight",
                supported =
                {
                        "landscapeRight",
                },
        },
        
        iphone =
        {
                plist =
                {
                        UIAppFonts = 
                        {
                                "MyFont.ttf"
                        },
 
                        UIStatusBarHidden=true,
                        UIPrerenderedIcon = true
 
 
                        
                },
        }
               
}

Ignore me. Font wasnt installed on PC :)

I was wrestling with this last night. I have discovered that on Android, you specify the filename, MINUS the file extension.

i.e. "amienne.ttf" becomes "amienne" for Android, while on iOS it would be "Amienne".

Also make sure the actual font file is in the root folder of your project.

Thanks for the response

How does your build.settings file look if you dont mind sharing

Sure...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
settings =
{
 
        androidPermissions =
   {
       "android.permission.VIBRATE"
   },
 
        orientation =
        {
                default = "landscapeRight",
                                content = "landscapeRight",
                                supported =
                                        {
                                        "landscapeRight"
                                        },
        },
 
        iphone =
        {               
                 plist =
                {
                                
                                MinimumOSVersion="4.3", 
                                UIApplicationExitsOnSuspend = false,
                                UIAppFonts = 
                        {
                                "amienne.ttf",
                                "teen.ttf"
                        },
 
                                CFBundleURLTypes =
            {
                {
                    CFBundleURLSchemes =
                    {
                        "fb363179733694583",
                    }
                }
            },
                        CFBundleIconFile = "Icon.png",
                        CFBundleIconFiles = {
                                "Icon.png" , 
                                "Icon@2x.png" , 
                                "Icon-72.png" , 
                                "Icon-Small-50.png" , 
                                "Icon-Small.png" , 
                                "Icon-Small@2x.png"
                        },
                },
        }
}

thanks for that

So when you say you are missing the TTF off you mean in code when specifying a newText object?

Yes, I just set up a table called fontName and set the values depending on system.getInfo("platformName").

Thanks again for your help thats clear

views:2380 update:2012/2/13 9:11:28
corona forums © 2003-2011