Can't use font in corona simulator

Quick chime in here:

  1. If you choose a large font size, some fonts will not work.  (Probably requiring too much memory to render).

  2. Some fonts are just broken, especially free ones.

  3. Some fonts will not print when you use a string like this: “BOB”, but if you do this, they will print " BOB " (notice space at front and at end).

  4. When you encounter a font problem, the best way to get help is to make a tiny project with these files and share it with the folks here so we can see it live and help debug it:

  • main.lua - Just one line showing you using the font and demonstrating it NOT working.
  • config.lua - We want to see this because it helps us understand how scaling may be affecting things.
  • build.settings - Super important if you want to use your font on iOS.  We need to check that bit too.
  • font.ttf (the font or fonts that are giving you trouble)

With the info from #4, we’ll have everything we need to help you and not worry about ambiguity in the forums post.

Hi guys, thanks for your help!

my test project link: https://www.dropbox.com/s/0qlkorlmwps94ng/HelloWorld.zip?dl=0

So i repeat:

  1. the font from project works well in iOS, Android, Mac OS, Win8

  2. So, Win7:

  2.a font works well in programs such as Photoshop, MS Office Word, Unity 3D etc

  2.b font doesn’t work in Corona Simulator. (there is no warning about “Could not found font…”)

I don’t have another Win7 PC to test, so if somebody have, please do tests.

Thank you all!

@mitsik,

  1. I ran your project on Windows 7 (in simulator) and it doesn’t show the text.

  2. I modified the project and simplified it a little more.  I also added code to print out any matches for ‘gothic’ (case-insensitive compare) in the loaded fonts.

http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2015/08/fonts/HelloWorld.zip

  1. I edited the font and fixed some issues with (ttfedit), but it still didn’t work.

  2. Interestingly, the font uses an odd name in when installed on the system:

actualname.jpg

I’m at a loss for how to fix this.  It just seems broken under Windows 7.

@roaminggamer

thanks for your tests.

I found one issue. I think you can reproduce it.

In Control Panel -> Fonts I have Arial font. If you open it there will be a lot of arial fonts such as Arial Bold, Arial Black, Italic etc

next, in main.lua change searchString to “arial”, it doesn’t show all these fonts - Bold, Black Italic. Just only Arial.

When I try to use “Arial Bold” i see warning in console “Could not load font Arial Bold. Using default font.”

So, I think simulator doesn’t look “inside” font Arail to find Arial Bold, Arial Italic etc.

However, if you double click Arial Bold it shows font properties where font name is “Aria”, not  “Arial Bold” (I have russian UI, but I made some translation)

u11DSOs.png

I’m confused

This is not my “GothicBold” font issue, but how can i use simple Arial fonts. I have the same problems with other fonts like Raleway, Roboto. Simulator doesn’t see Bold, Italic etc. They are free, but available to download from google fonts. I don’t think these fonts corrupted or bad. Maybe it is Win7 font system specific issue?

Thanks

The font works on photoshop.

This is the file.

I tried your font with roaminggamer’s HelloWorld example. it doesn’t work. Could not found Dekar font, but it shows Dekar in fonts list native.getFontNames()

very strange. do you have win7 now?

Yes

Responding re: Font Families (Arial Bold, Arial Black, etc.)  I’ve frequently had problems using fonts that are part of a family.  I think it has something to do with looking up a variant of a font within the family.  

However, I’ve never looked at the source for this so I can’t give any insights into why Font Families are sometimes problematic.

I’m afraid I just avoid them in advance.  I know this doesn’t help much.

Tip: I always test my fonts on my target devices before using them in app dev.  That way I don’t get surprised later.

Best of luck on this.

But on device it works perfectly fine.

The main goal is a device. So, this is not very big problem we have. it makes development process a bit slower, that’s it.

I use something like this 

local fontName = “GothicBold”

if (system.getInfo( “platformName” ) == “Win”)then

    fontName = “AnotherFontName”

end

I need to use this because i see nothing on the screen with my font :slight_smile:

This thread is getting a bit long.  If I can summarize:

There seems to be a font issue on Windows 7, but not on device and not on OS-X. While I realize that testing in the simulator is important, perhaps this is one case where it’s time to move on and either:

a) Upgrade to Win 10 continue to develop and test in the simulator

b) Test on device. Not the best solution, but it will work.

If the concern is releasing Win32 desktop apps, or if you’re stuck on Windows 7 for some reason, then file a bug report.  The simple text example with your trouble fonts will do. If it works fine on Win 10, Win 8 and all devices, but not Win 7, perhaps the engineers can find a work around.

To file a bug report create a simple project that includes:

main.lua

config.lua

build.settings

your fonts

In the main.lua try to create a display object for each font that says “Hello World”.

Put all of that into a .zip file (no .bz2 files or other weird compression) and use the Report a bug link at the top of the page.

In the form that comes up, clearly state your problem. Mention it only happens on Windows 7 (if that’s really the case). Put a link to this forum thread in the post. After you submit the bug, you will get an email that will have a Case ID number in the subject of the email. Please post that number back to this forum thread as a reference.

Thanks

Rob

And it works? I dont understand what you’re trying to achieve with this code.

We have made some changes to font handling and we are updating the guide to reflect the changes.

Rob

for now I cant use any costum font?
and why “Eras Light Itc” works?

Hi @idanahal3,

The guide is now updated. If you follow these steps carefully and precisely and a custom font still doesn’t work, most likely there is a problem/issue with the actual font file (uncommon but not unheard of).

https://docs.coronalabs.com/guide/system/customFont/index.html

Brent

I did exactlly that and it doesn’t worked…  :frowning:

i tried 9 different fonts and non of them worked…

I installed them on my computer and restart the computer.

please help me

Are you using Windows or OSX?

Can you post code where you are trying to use the font?

Rob

Im using Windows

    highScore\_txt = display.newText("BEST: " ..loadFile("highscore"), \_W/2, \_H\*0.458, "Wekar" , 101 )     highScore\_txt:setFillColor(0, 0, 0)

And what is the File name of the font file?

Is it in the same folder with your main.lua?

Rob

Also are you getting any errors in your console log (the black and white text window that got opened behind the simulator)?