Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Issue with TrueType Fonts - crashing Gideros iOS Player — Gideros Forum

Issue with TrueType Fonts - crashing Gideros iOS Player

krisiskrisis Member
edited January 2013 in Bugs and issues
I have been working on a project using the tahoma.ttf that came bundled with @ar2rsawseen's very useful game template and it has been working fine. However when I switch out the font for any .ttf font that I download from Google Web Fonts, changing to any scene containing the font will lock up the Gideros iOS Player. The application becomes unresponsive and I can see it pegging CPU at 100% and memory usage continually increasing and I have to force kill it. The same occurs on the Gideros iOS Player on my device (iPhone5). There are no errors in the shown in the player or any debug info.

Is there something I need to do with the .ttf files from Google Web Fonts (or other sources) to make them compatible with Gideros before they can be used?

Thanks.
[ Twitter: pushpoke | Facebook: facebook.com/pushpoke | Web: pushpoke.com | Letter Stack iOS: letterstack.com ]
Tagged:

Comments

  • moopfmoopf Guru
    edited January 2013
    It's a known issue in the latest version and apparently @atilim has fixed it for the next release. It's been driving me mad :D

    Edit: Actually, I'm not sure that is the same issue now I read your post again. I've been having a problem with ttf periodically crashing the player but not every time.
  • That was an issue with one build only and I thought it was fixed there after.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • ar2rsawseenar2rsawseen Maintainer
    edited January 2013
    What both of them meant to say is:
    Which version of Gideros are you using @krisis?

    As far as I know there is no need to do anything with font if it's in ttf format
  • I'm using 2012.09.02. I tried with multiple Google Web Fonts, such as:
    http://www.google.com/webfonts/download?kit=hWBMzThW3MSPyUN8rdo-Y_esZW2xOQ-xsNqO47m55DA

    Let me try with the latest version and see if the issue is still happening...
    [ Twitter: pushpoke | Facebook: facebook.com/pushpoke | Web: pushpoke.com | Letter Stack iOS: letterstack.com ]
  • Upgraded to 2012.09.06 and this is still happening for me.

    I'm setting up 3 fonts under a global config:

    conf = {
    textFont = TTFont.new("fonts/Ubuntu/Ubuntu-Regular.ttf", 20),
    titleFont = TTFont.new("fonts/Ubuntu/Ubuntu-Regular.ttf", 40),
    blockFont = TTFont.new("fonts/Ubuntu/Ubuntu-Regular.ttf", 60),
    ...
    }

    And it's being used on a Help screen for a few paragraphs of text, such as:
    local title = TextWrap.new("OVERVIEW", 100, "left", conf.titleFont)
    title:setPosition(-layer:getWidth()/2 + 30, -layer:getHeight()/2 + 100)
    title:setTextColor(0xffffff)
    layer:addChild(title)

    The Gideros Player locks up as soon as I try and switch scenes to the Help screen.

    Using "fonts/tahoma.ttf" this works fine...
    [ Twitter: pushpoke | Facebook: facebook.com/pushpoke | Web: pushpoke.com | Letter Stack iOS: letterstack.com ]
  • So I have been able to resolve the issue by commenting out bits of text one by one until I could consistently get it to crash.

    The offending code was:
    	local letterA = TextWrap.new("A", 40, "center", conf.blockFont)
    	letterA:setTextColor(0xffffff)
    	layer:addChild(letterA)
    	local letterM = TextWrap.new("M", 40, "center", conf.blockFont)
    	letterM:setTextColor(0xffffff)
    	layer:addChild(letterM)
    By modifying the TextWrap width var from 40 to 60 the crash no longer occurs. I'm guessing this is an issue with the font width of these particular characters in the new fonts I tried vs Tahoma (which must have a narrower font width). TextWrap tries to determine when to wrap the text to the next line and the size of the font character must have exceeded the line width so it was probably stuck in some kind of loop pushing it to the next line continually.
    [ Twitter: pushpoke | Facebook: facebook.com/pushpoke | Web: pushpoke.com | Letter Stack iOS: letterstack.com ]
  • TextWrap, that seems like an external library that has caused this problem, I was looking up the Gideros documentation to see where this problem stemmed from. I also though that this was a new feature @Atilim added...
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • Here is a video of something that I was working on (on the back burner right now) it creates clickable text in a paragraph you can set the font and the size and it adjusts accordingly. It also has the buttons (the blue/green + )that are clickable and show an image on tapping and the isometric tile was a test from my earlier game Dark Horse where I was trying to recreate it using Gideros which is rendering quite nicely.



    the way to add the hotspot tapable buttons is
     local a1 = newImage("image.png", 100, 100)
     addHotspotFrom(a1)
     
    function onTap1(self, x, y)
    end 
     
    a1.callback = "onTap1"
    a1.icon = "Apple.png"
    and that's all there is to that.

    With the text it is as simple as
     local t1 = readToMeText[[the para text here]]
     t1:setY(400) -- position the text accordingly
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • Yeh, TextWrap is a class by @ar2rsawseen that does a pretty decent job of fitting text to a specific area, including word wrapping, text justification (dynamic word spacing), etc. However, it mustn't handle the edge case I described when you set the text area too small for the text.

    Appreciate the quick replies in this thread.
    [ Twitter: pushpoke | Facebook: facebook.com/pushpoke | Web: pushpoke.com | Letter Stack iOS: letterstack.com ]
  • ar2rsawseenar2rsawseen Maintainer
    edited January 2013
    Oh yes that might happen :)
    I'm trying to make the libs for as general use as possible, but usually it gets mostly tested for my needs in that particular situation.

    So sorry for any inconvenience ;)
  • No problem. Your libs have been very helpful.
    [ Twitter: pushpoke | Facebook: facebook.com/pushpoke | Web: pushpoke.com | Letter Stack iOS: letterstack.com ]
Sign In or Register to comment.