Custom font problem

The exact same code works when I have installed the font into my system…
Screenshots ahead:
current outcome:

project folder

code
[import]uid: 76405 topic_id: 34945 reply_id: 334945[/import]

Hello @qaisjp,
Is “Quicksand Book” how the font is named, exactly, at the “system level”? You can run the following code and view the Terminal to check on this (pulled from this tutorial: http://www.coronalabs.com/blog/2011/07/13/custom-fonts-corona/)

local sysFonts = native.getFontNames()  
for k,v in pairs(sysFonts) do print(v) end  

If you have the name correct, perhaps there’s something wrong with the font file, or something else at a deeper level. Please keep me posted on what you discover on this…

Thanks,
Brent
[import]uid: 200026 topic_id: 34945 reply_id: 138893[/import]

The exact code works when installed into the system, so that is the font name at a system level. It doesn’t appear in native.getFontNames(); I already tried that. [import]uid: 76405 topic_id: 34945 reply_id: 138961[/import]

Hmmm… I assume you specified this custom font in your “build.settings” for the Corona project, and checked that it’s defined exactly in the right place with the correct file name? [import]uid: 200026 topic_id: 34945 reply_id: 139015[/import]

I converted that ttf from OTF>TTF? Does Corona support OTF? and does that make a difference?

I assume that is correct? [import]uid: 76405 topic_id: 34945 reply_id: 139016[/import]

Yes, this looks correct, and yes, Corona supports .otf (I use that myself in a current project). Can you try using the original .otf file? Maybe something odd happened in the conversion.

I also find it strange that it’s not showing up at all in “native.getFontNames()”. If it doesn’t show up there, it likely won’t work on the device.

Brent [import]uid: 200026 topic_id: 34945 reply_id: 139022[/import]

I replaced the font with the original font and renamed the item in the config file.
Here is the link to the entire project: corona_0.zip [import]uid: 76405 topic_id: 34945 reply_id: 139028[/import]

Hi again,
OK, found the problem. You’re defining your font (The “UIAppFonts” setting) in config.lua, while this actually needs to be defined it the build.settings file.

Let me know what happens after you change it over. [import]uid: 200026 topic_id: 34945 reply_id: 139030[/import]

Argh, still doesn’t work :confused:
Here is the link to the updated project: corona_0.1.zip [import]uid: 76405 topic_id: 34945 reply_id: 139031[/import]

Argh, still doesn’t work :confused:
Here is the link to the updated project: corona_0.1.zip [import]uid: 76405 topic_id: 34945 reply_id: 139033[/import]

Hi @qaisjp,
I just experimented with this on my side. The solution was to install the font in OS X Font Book. Have you done this already? Double-click the font file and it should open the Font Book application. Then click “Install Font” and it should go to work. After I did that, it showed up perfectly on the Simulator screen.

Brent [import]uid: 200026 topic_id: 34945 reply_id: 139049[/import]

Yeah it worked when I tried that, but shouldn’t it work anyway? Would it work on Android/iOS?
Thanks! [import]uid: 76405 topic_id: 34945 reply_id: 139070[/import]

Yes, as long as you specified the font properly in your “UIAppFonts” table, and you’re calling it (in code) by the name you get from native.getFontNames() after it’s properly installed in FontBook, it should work.

On Android, it’s a bit different. You have to specify the custom font by its file name without the extension, not by font family name like you do on Mac or iOS. For example, if the font file name is “Quicksand_Book.otf” in the directory, then your display.newText() call needs to access it by file name such as “Quicksand_Book” without the extension. The reason is, the app’s custom font is not “installed” on Android, so Corona needs to load it by file name (minus extension).

Hope this helps!
Brent [import]uid: 200026 topic_id: 34945 reply_id: 139182[/import]

Alright, thanks! [import]uid: 76405 topic_id: 34945 reply_id: 139183[/import]

Hello @qaisjp,
Is “Quicksand Book” how the font is named, exactly, at the “system level”? You can run the following code and view the Terminal to check on this (pulled from this tutorial: http://www.coronalabs.com/blog/2011/07/13/custom-fonts-corona/)

local sysFonts = native.getFontNames()  
for k,v in pairs(sysFonts) do print(v) end  

If you have the name correct, perhaps there’s something wrong with the font file, or something else at a deeper level. Please keep me posted on what you discover on this…

Thanks,
Brent
[import]uid: 200026 topic_id: 34945 reply_id: 138893[/import]

The exact code works when installed into the system, so that is the font name at a system level. It doesn’t appear in native.getFontNames(); I already tried that. [import]uid: 76405 topic_id: 34945 reply_id: 138961[/import]

Hmmm… I assume you specified this custom font in your “build.settings” for the Corona project, and checked that it’s defined exactly in the right place with the correct file name? [import]uid: 200026 topic_id: 34945 reply_id: 139015[/import]

I converted that ttf from OTF>TTF? Does Corona support OTF? and does that make a difference?

I assume that is correct? [import]uid: 76405 topic_id: 34945 reply_id: 139016[/import]

Yes, this looks correct, and yes, Corona supports .otf (I use that myself in a current project). Can you try using the original .otf file? Maybe something odd happened in the conversion.

I also find it strange that it’s not showing up at all in “native.getFontNames()”. If it doesn’t show up there, it likely won’t work on the device.

Brent [import]uid: 200026 topic_id: 34945 reply_id: 139022[/import]

I replaced the font with the original font and renamed the item in the config file.
Here is the link to the entire project: corona_0.zip [import]uid: 76405 topic_id: 34945 reply_id: 139028[/import]