Help with font not showing on device build (shows up correct in the simulator)

So, Im trying to use a custom font and ive followed the tutorial from corona. Ive got it up and running and it works fine in the emulator but when I build for a device (ios-iphone 5s) xcode gives me this error 

WARNING: The font (04b 30) could not be found. Using system font instead.

I am using a mac and I have my font in the correct directory. (at least I think I do)

If if anyone can help me I would really appreciate it. Thanks

Nate

What is the font’s file name?

What is the font’s internal name?

Can you post your build.settings?

Can you post the line of code where you’re trying to use the font?

What version of Corona SDK are you running?

Rob

Thanks for the fast response Rob. Here ya go. 

Font file name = pixeljoe.ttf

fonts internal name = “04b 30”

Build Settings

[lua]–

settings =

{

  plugins = {

  --[[remove this line to implement google game services

    [“CoronaProvider.gameNetwork.google”] =

     {

        publisherId = “com.coronalabs”,

        supportedPlatforms = { android = true },

     },

    ]] --remove this line to implement google game services

    [“plugin.google.play.services”] =

        {

            publisherId = “com.coronalabs”

        },

  --[[remove this line to implement iAds

    [“CoronaProvider.ads.iads”] =

    {

       – required

       publisherId = “com.coronalabs”,

    },

    ]] --remove this line to implement iAds

    [“facebook”] =

    {

        – required

        publisherId = “com.coronalabs”,

        supportedPlatforms = { iphone = true },

    },

  },

orientation =

{

default = “portrait”,

supported = { “portrait” }

},

android =

{

    googlePlayGamesAppId = “XXXXXXXX”,  --app id number for google game services

usesPermissions =

{

“android.permission.INTERNET”,

      “android.permission.ACCESS_NETWORK_STATE”,

      “android.permission.READ_PHONE_STATE”

},

},

iphone =

{

plist =

{

CFBundleIconFile = “Icon.png”,

CFBundleIconFiles =

{

                “Icon.png”,

                “Icon@2x.png”,

                “Icon-60.png”,

                “Icon-60@2x.png”,

                “Icon-72.png”,

                “Icon-72@2x.png”,

                “Icon-76.png”,

                “Icon-76@2x.png”,

                “Icon-Small.png”,

                “Icon-Small@2x.png”,

                “Icon-Small-40.png”,

                “Icon-Small-40@2x.png”,

                “Icon-Small-50.png”,

                “Icon-Small-50@2x.png”,

},

        UIAppFonts =

            {

                “pixeljoe.ttf”,

            },

UIApplicationExitsOnSuspend = false, – must be false for single sign-on to work

FacebookAppID = “XXXXXXXXX”, --facebook appId

CFBundleURLTypes =

{

{

CFBundleURLSchemes =

{

“fbXXXXXXXXX”, – facebook appId

}

}

}

}

}

}

[/lua]

Using the font in many places but it all looks the same as this line. 

[lua]–local scoreText = display.newEmbossedText(group, 0, 0, 0, “04b 30”, 30); [/lua]

Ive also tried this not sure if it makes a difference. Didn’t in the simulator or build for me. 

[lua]–local scoreText = display.newEmbossedText(group, “04b 30”, 0, 0, “04b 30”, 30); [/lua]

Running the basic version of Corona sdk v2014.2393

Also should be noted that xcode has given me the same error but with both names of the font. For instance today it gave me this

Oct 26 11:56:46 Nates-iPhone LastTryAgain[3740] <Warning>: WARNING: The font (pixeljoe) could not be found. Using system font instead.

Where as yesterday it was saying the font 04b 30 could not be found. 

Thanks

Generally people who have font’s who have filenames different than the internal names struggle.  Spaces seem to cause issues too, though I’m not able to pin it down.

Also your build.settings may have issues.  It’s hard to read because it’s not indented well and while I didn’t see any obvious errors, that doesn’t mean there’s not an error in your build.settings file.

Rob

Yeah im positive my font names are correct. Damn, this is frustrating. Ill look through the build.settings. 

Thanks

Can you try a different font?

What is the font’s file name?

What is the font’s internal name?

Can you post your build.settings?

Can you post the line of code where you’re trying to use the font?

What version of Corona SDK are you running?

Rob

Thanks for the fast response Rob. Here ya go. 

Font file name = pixeljoe.ttf

fonts internal name = “04b 30”

Build Settings

[lua]–

settings =

{

  plugins = {

  --[[remove this line to implement google game services

    [“CoronaProvider.gameNetwork.google”] =

     {

        publisherId = “com.coronalabs”,

        supportedPlatforms = { android = true },

     },

    ]] --remove this line to implement google game services

    [“plugin.google.play.services”] =

        {

            publisherId = “com.coronalabs”

        },

  --[[remove this line to implement iAds

    [“CoronaProvider.ads.iads”] =

    {

       – required

       publisherId = “com.coronalabs”,

    },

    ]] --remove this line to implement iAds

    [“facebook”] =

    {

        – required

        publisherId = “com.coronalabs”,

        supportedPlatforms = { iphone = true },

    },

  },

orientation =

{

default = “portrait”,

supported = { “portrait” }

},

android =

{

    googlePlayGamesAppId = “XXXXXXXX”,  --app id number for google game services

usesPermissions =

{

“android.permission.INTERNET”,

      “android.permission.ACCESS_NETWORK_STATE”,

      “android.permission.READ_PHONE_STATE”

},

},

iphone =

{

plist =

{

CFBundleIconFile = “Icon.png”,

CFBundleIconFiles =

{

                “Icon.png”,

                “Icon@2x.png”,

                “Icon-60.png”,

                “Icon-60@2x.png”,

                “Icon-72.png”,

                “Icon-72@2x.png”,

                “Icon-76.png”,

                “Icon-76@2x.png”,

                “Icon-Small.png”,

                “Icon-Small@2x.png”,

                “Icon-Small-40.png”,

                “Icon-Small-40@2x.png”,

                “Icon-Small-50.png”,

                “Icon-Small-50@2x.png”,

},

        UIAppFonts =

            {

                “pixeljoe.ttf”,

            },

UIApplicationExitsOnSuspend = false, – must be false for single sign-on to work

FacebookAppID = “XXXXXXXXX”, --facebook appId

CFBundleURLTypes =

{

{

CFBundleURLSchemes =

{

“fbXXXXXXXXX”, – facebook appId

}

}

}

}

}

}

[/lua]

Using the font in many places but it all looks the same as this line. 

[lua]–local scoreText = display.newEmbossedText(group, 0, 0, 0, “04b 30”, 30); [/lua]

Ive also tried this not sure if it makes a difference. Didn’t in the simulator or build for me. 

[lua]–local scoreText = display.newEmbossedText(group, “04b 30”, 0, 0, “04b 30”, 30); [/lua]

Running the basic version of Corona sdk v2014.2393

Also should be noted that xcode has given me the same error but with both names of the font. For instance today it gave me this

Oct 26 11:56:46 Nates-iPhone LastTryAgain[3740] <Warning>: WARNING: The font (pixeljoe) could not be found. Using system font instead.

Where as yesterday it was saying the font 04b 30 could not be found. 

Thanks

Generally people who have font’s who have filenames different than the internal names struggle.  Spaces seem to cause issues too, though I’m not able to pin it down.

Also your build.settings may have issues.  It’s hard to read because it’s not indented well and while I didn’t see any obvious errors, that doesn’t mean there’s not an error in your build.settings file.

Rob

Yeah im positive my font names are correct. Damn, this is frustrating. Ill look through the build.settings. 

Thanks

Can you try a different font?

The simulator will always show up correctly since you have the font properly installed on your mac.

For android the font name to use in your code should be the same as the file name of the font, i.e.; “pixeljoe”

But for IOS you need to use the internal name which can be a huge pain especially if it contains spaces. You may have to try removing the space between the words, i.e.; “04b30”

For example if I use eurobold.ttf, for android its simply “eurobold”, but for IOS (even though the internal name is Eurostile Bold) I need to use “EurostileBold”. However, this doesn’t always work  so you may end up needing to try a bunch of different combinations.

The simulator will always show up correctly since you have the font properly installed on your mac.

For android the font name to use in your code should be the same as the file name of the font, i.e.; “pixeljoe”

But for IOS you need to use the internal name which can be a huge pain especially if it contains spaces. You may have to try removing the space between the words, i.e.; “04b30”

For example if I use eurobold.ttf, for android its simply “eurobold”, but for IOS (even though the internal name is Eurostile Bold) I need to use “EurostileBold”. However, this doesn’t always work  so you may end up needing to try a bunch of different combinations.

I have the same problem with corona enterprise. It works fine on android but on iOS the fonts aren’t loaded. here are the fonts:

AdobeArabic-Bold.otf

AdobeArabic-Regular.otf

internal name in code:

fontName = “AdobeArabic-Bold”

fontName = “AdobeArabic-Regular”

Hi, I have the same problem.
SourceHanCodeJP-Bold.otf and SourceHanCodeJP-Normal.otf.

There are no problems with previous version #2644.

Corona Enterprise does not using the build.settings file.  The fonts have to be added as file in the project and then you have to update the plist yourself to include the UIAppFonts table yourself.

Rob

I see. But this problem does not occur until #2687. Why do you think it is so? 

I’ve just updated from Enterprise build #2541 to #2719 and I’m suddenly getting the same thing for fonts which previously had worked. I had never manually put any font details into my plist file, even when they worked.

Rob you said “Corona Enterprise does not using the build.settings file.” Is that a recent change? My understanding is that the build.settings file did get used to populate some values in the plist. There is even a file in Enterprise called “buildSettingsToPlist.lua” which can be found at /CoronaEnterprise/Corona/mac/bin/buildSettingsToPlist.lua

I’m having some other issues too, most noticably one where if I start the game in landscape it acts as though it’s still in portrait (our game supports both orientations). This worked before, and if I start in portrait then rotate to landscape it works, but starting in LS does not. I’m now wondering if this is another issue where the plist does not have correct values?

The plist is definitely not being populated like it was before. I just looked inside an ipa file I built yesterday using #2541, and the plist has loads of things that I’ve only ever specified in build.settings:

icon file names url types CoronaViewSupportedInterfaceOrientations FacebookAppID Fonts provided by application Required background modes Initial interface orientation UILaunchImages

These are all things that are now missing since I updated Enterprise to #2719 this morning, and while I can add them manually I currently have 8 apps on the go, and would prefer not to have to do this manually if the build.settings file could carry on doing it.

Edit: I’ve now tried adding the missing fields manually, and the game is behaving as expected again. But I’m still unsure of why the plist isn’t being populated like it was previously.

Maybe it’s just on Android we don’t copy anything over.

Rob