Custom Font Text Does Not Work, No Matter What....

Well, I looked at answers given before, read about 20 different tutorials, but nothing seems to work.

I’ve created, for this test, since nothing worked, 3 text fields with text in them, with 3 different version of font name, and non of them work, not in simulator (same font could not be loaded error message) and not on my device (galaxy sIII), and since this should work also on ios, i had this is the settings as well:

  UIAppFonts =                  {                     "MuseoSans\_500.ttf",                     "MuseoSans\_700.ttf",                     "MuseoSans\_900.ttf"                 }

and in my application:

  local fg\_TEXTBARTEXT = display.newText("AAAAA", 0, 0, "Museo Sans 700", 16); fg\_TEXTBARTEXT:setTextColor(210,210,210);   local fg\_TEXTBARTEXT2 = display.newText("AAAAA", 0, 0, "Museosans\_700", 16); fg\_TEXTBARTEXT2:setTextColor(210,210,210);   local fg\_TEXTBARTEXT3 = display.newText("AAAAA", 0, 0, "MuseoSans\_700.ttf", 16); fg\_TEXTBARTEXT3:setTextColor(210,210,210);

these three diffent pieces of code give me the same error 3 times, and shows up the same, as I’ve said, in the simulator and on my mobile device.

What am I doing wrong??

Hi @formatc,

I assume you have that “UIAppFonts” table nested within the “iphone” and then the “plist” table?

Also, fonts work a bit different on Android vs. iOS. Have you seen this FAQ on the matter?

http://www.coronalabs.com/blog/2013/01/16/faq-wednesday-custom-fonts/

Let me know if this helps or not.

Brent

I did read this article, and as you can see in my code, I tried all 3 methods that were supposed to cover android and ios, these 3 lines I create have all the same font, the system font, in all cases… something does not work, and I can’t seem to find why or what.

And yes, I do have the UIAppFonts table where it should be, I just didn’t want to copy the whole table, just the part important to my question, so you’ll know what I did to try and make it work.

Also my text lines code is not complete here, I position the lines at different places on the screen so I could see them all, I just didn’t put any code that would not be crucial to the actual problem to save on some code clutter.

Is that the EXACT way the font appears in FontBook on a Mac (appears at the bottom of the window when you select the font)?

If you’re trying to make it work on android, you just use the file name without the “.ttf” at the end.

It took me forever to figure it out, but it’s actually different on iOS and Android. iOS is the font name, Android is the file name without the .ttf

Does the font display on any iOS device? If so, does it only fail in the Simulator when an iOS device is simulated? Remember that on OS X, you need to “install” the font into Font Book by double-clicking it. This might be what hasn’t been done…

Well, right now I’m testing this only on android (galaxy sIII), and it does not work on the simulator and does not work on the device.

if you check out the second example, I’m creating 3 different text, one of each method, so logic follows at least one will work on each device, one for ios , one for android and one for the simulator running on a PC, where the font is in did installed, the name is spelled correctly.

Running this code should show me 3 lines of text, where one of them should work on each platform, but so far non of them work on any platform.

I can upload a zip file with the code, and the font, if it helps.

I have used a custom font when testing on my galaxy sIII, I all i did was copy the font file into my corona project ( file is Marker Felt.ttf) and then in code you use the filename without the extension. This should work

Yeah, it’s the same as I did.

The only thing I didn’t do, was try this with a different font then the one the designer gave me, maybe the font file itself is bad… I’ll try this with a different font I can wrestle out of my system and see if something changes.

Well, hat off to you guys, and a large “I’m sorry”, since the single most important test I should have done and didn’t was try this with a different font, and what do you know, it works just fine, the problem, somehow, is in the font itself.

We are looking for a different source for that font, but if we can’t find a version that works we’ll choose another font, much to our designer laments.

Thanks again, and a small sorry as closure… :slight_smile:

Hi @formatc,

I assume you have that “UIAppFonts” table nested within the “iphone” and then the “plist” table?

Also, fonts work a bit different on Android vs. iOS. Have you seen this FAQ on the matter?

http://www.coronalabs.com/blog/2013/01/16/faq-wednesday-custom-fonts/

Let me know if this helps or not.

Brent

I did read this article, and as you can see in my code, I tried all 3 methods that were supposed to cover android and ios, these 3 lines I create have all the same font, the system font, in all cases… something does not work, and I can’t seem to find why or what.

And yes, I do have the UIAppFonts table where it should be, I just didn’t want to copy the whole table, just the part important to my question, so you’ll know what I did to try and make it work.

Also my text lines code is not complete here, I position the lines at different places on the screen so I could see them all, I just didn’t put any code that would not be crucial to the actual problem to save on some code clutter.

Is that the EXACT way the font appears in FontBook on a Mac (appears at the bottom of the window when you select the font)?

If you’re trying to make it work on android, you just use the file name without the “.ttf” at the end.

It took me forever to figure it out, but it’s actually different on iOS and Android. iOS is the font name, Android is the file name without the .ttf

Does the font display on any iOS device? If so, does it only fail in the Simulator when an iOS device is simulated? Remember that on OS X, you need to “install” the font into Font Book by double-clicking it. This might be what hasn’t been done…

Well, right now I’m testing this only on android (galaxy sIII), and it does not work on the simulator and does not work on the device.

if you check out the second example, I’m creating 3 different text, one of each method, so logic follows at least one will work on each device, one for ios , one for android and one for the simulator running on a PC, where the font is in did installed, the name is spelled correctly.

Running this code should show me 3 lines of text, where one of them should work on each platform, but so far non of them work on any platform.

I can upload a zip file with the code, and the font, if it helps.

I have used a custom font when testing on my galaxy sIII, I all i did was copy the font file into my corona project ( file is Marker Felt.ttf) and then in code you use the filename without the extension. This should work

Yeah, it’s the same as I did.

The only thing I didn’t do, was try this with a different font then the one the designer gave me, maybe the font file itself is bad… I’ll try this with a different font I can wrestle out of my system and see if something changes.

Well, hat off to you guys, and a large “I’m sorry”, since the single most important test I should have done and didn’t was try this with a different font, and what do you know, it works just fine, the problem, somehow, is in the font itself.

We are looking for a different source for that font, but if we can’t find a version that works we’ll choose another font, much to our designer laments.

Thanks again, and a small sorry as closure… :slight_smile: