Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
Invalid font size. - Gideros Forum

Invalid font size.

Personal greetings. Eventually some of my project has a random "crash" at startup of either sprite that has text inside it.
The debug output reports the phrase "Invalid font size." and points the line that has a font etc ...
Good but this has been happening quite randomly, and when closing and reopening the error does not happen. And the font / text with error is no longer wrong and displays normally.

What could cause this? They are different types of fonts and different sizes, but then it works again.

"Invalid font size."

Comments

  • totebototebo Member
    I have also seen this issue, but only in the player so far. I assumed it had something to do with too many files open (which is OS dependent and happens if you refresh the player a LOT).

    In my case the "invalid font size" is taken from a macro which I define in init.lua. Is your font size also a macro, or a "normal" var?

    Likes: kinrpg

    My Gideros games: www.totebo.com
    +1 -1 (+1 / -0 ) Share on Facebook
  • kinrpgkinrpg Member
    totebo said:

    I have also seen this issue, but only in the player so far. I assumed it had something to do with too many files open (which is OS dependent and happens if you refresh the player a LOT).

    In my case the "invalid font size" is taken from a macro which I define in init.lua. Is your font size also a macro, or a "normal" var?

    In case I write one of this for each font size.
    In this example I put 20 in size.

    local fontP = TTFont.new("Fontes/Hobby-of-night.ttf", 20)
  • SinisterSoftSinisterSoft Maintainer
    I tend to open one or two fonts globally and use them throughout - not open them multiple times locally.
  • totebototebo Member
    Ok @kinrpg, it doesn't seem to be macros causing the issue.

    @SinisterSoft I also create all fonts at startup and then re-use them. Even so, I get this problem every now and then. I assume it's to do with too many files open in the player?
    My Gideros games: www.totebo.com
  • kinrpgkinrpg Member
    totebo said:

    Ok @kinrpg, it doesn't seem to be macros causing the issue.

    @SinisterSoft I also create all fonts at startup and then re-use them. Even so, I get this problem every now and then. I assume it's to do with too many files open in the player?

    It's like me. This error comes quite randomly. And it seems to be happening in 2018.2, because I never had this error before updating.
  • totebototebo Member
    @kinrpg do you only get this issue in the player?
    My Gideros games: www.totebo.com
  • kinrpgkinrpg Member
    totebo said:

    @kinrpg do you only get this issue in the player?

    Yes. The problem began to appear when I updated Gideros. Before that I used only version 16.04, I am currently using 18.2.1

    And I'm sorry, I accidentally clicked Reject and did not find where to undo this. :#
  • hgy29hgy29 Maintainer
    going a little technical, it happens when calling FT_Set_CharSize in freetype library returns an error. I agree this doesn't help much without knowing what kind of errors could occur at that point.

    Likes: kinrpg

    +1 -1 (+1 / -0 ) Share on Facebook
  • amnonamnon Member
    edited August 6
    Can confirm running into the same problem. In my case runs fine on local player as well as on Android mobile phone player. Same code consistently crashes on a certain font creation when running on player of Android tablet. Looking for workarounds.

    Update: Since using manual garbage collection didn't work (at least not in all cases), the workaround was creating a font cache mechanism so that fonts that were already created can be reused. This is a workaround and the issue should still be correctly resolved .

    Yet another update: On a Samsung tablet this "invalid font size" crash can occur even after creating 3 TTFonts. There's seems to be a bug with TTFont.new that makes it unusable on some devices.
Sign In or Register to comment.