Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
TTFont bug in 2012.2.2.1? — Gideros Forum

TTFont bug in 2012.2.2.1?

chipster123chipster123 Member
edited May 2012 in Bugs and issues
This simple example works on the PC player but not on the Android player
local font = TTFont.new("arial.ttf",14)
local text = TextField.new(font, "This is Arial")
text:setPosition(10, 310)
stage:addChild(text)
Am I missing something?
Tagged:

Comments

  • avoavo Member
    I just exported an app to an android device (not player) that uses this and it seems to work as usual. I will do some more tests in a bit after I finish some other tests.

    Does it just not display in the player for you?
  • Yes, the exported android project works fine on the device also.
  • @chipster, just out of curiosity, have you updated your android player?
    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
  • atilimatilim Maintainer
    edited May 2012
    chipster123 uh.. yes I also got the error "arial.ttf: Error while reading font file." I'll update this thread when I found something about this bug. (And as you said, on desktop player it works)
  • chipster123chipster123 Member
    edited May 2012
    @atilim thanks for confirming. Also, there is a difference between how the same TTF font is rendered on the player vs the .apk build running on my device. Here is a picture showing the differences. Could this be related?

    Notice how the fonts have different positioning and extend differently.
    Also, the relative text spacing is exactly the same as shown here whether in 'pixel-perfect' or 'stretch' mode
    font_differences.jpg
    674 x 651 - 103K
  • petecpetec Member
    edited May 2012
    I think I'm having similar problems.

    I've got an app that displays OK in the player on my laptop but throws the error 'GOTHIC.TTF: Error while reading font file.' when I try playing it in the (updated) player on my phone. I've double checked to make sure that the font file is included in my project, which it is. (Edit: Oops - just seen that @atilim has already said this!)

    When I build the apk and run it, all double digit numbers that are positioned using a getWidth()/2 bit of coding to centre them only show the tens digit of the number and not the units. The tens digit appears to be centred.

    When I build exactly the same app using the previous version of Gideros, it works fine in the player on the computer and on the phone and the apk is also OK.

    Thanks, Pete
  • atilimatilim Maintainer
    edited May 2012
    thank you all for the detailed reports.

    I've fixed the first bug. It only occurs on android player. Most probably I'll fix the second one today (getWidth() of TextField) and release a new package (2012.2.2.2 :) ) that only addresses these two bugs.
  • ar2rsawseenar2rsawseen Maintainer
    Well, you always say that. And then release a new version with bunch of cool features :D
  • petecpetec Member
    Thanks @atilim. Just in case I wasn't clear, I only had the problem with getWidth() of a text field when I built the apk - the double digit numbers looked OK in the player on my computer.
  • atilimatilim Maintainer
    edited May 2012
    @ar2rsawseen :D If I can, this will be the first "bugfix only" version :)

    @petec, @chipster123 no matter how hard I tried, I couldn't make a difference between desktop player, android player and exported apk. @petec, what is the exact string that causes the problem? And that would be great if you can send me (atilim@g...com) a simple example that shows the problem.
  • petecpetec Member
    @atilim, I'm just about to send you an example that causes me the problem ...but I've just found that I only get this problem when I install it on my ZTE Blade (Arm6) and it works fine on a Nexus One and Archos 80 tablet.
  • chipster123chipster123 Member
    edited May 2012
    @petec, @atilim interesting. I'll have to run a test on a second device to see what's what.
  • AlexRuAlexRu Member
    @atilim, I also found one ttf problem. I use calculated x, y for TextField:setPosition(x, y) and some times TextField is distorted in the screen (at win-player and at device). It happens then x coordinate in not integer.

    Example:
    local my_font = TTFont.new("arial.ttf", 54)
     
    local text1 = TextField.new(my_font, "TEXT-1")
    text1:setPosition(100, 100) 					--normal
    stage:addChild(text1)
     
    local text2 = TextField.new(my_font, "TEXT-2")
    text2:setPosition(100.5, 200) 					--distorted
    stage:addChild(text2)
     
    local text3 = TextField.new(my_font, "TEXT-3")
    text3:setPosition(100, 300.5) 					--normal
    stage:addChild(text3)
    I have to use math.floor(x) to solve the problem. Сalculated x, y for Sprite:setPosition(x, y) work normal. I use 2012.2.2.
  • petecpetec Member
    I've just been able to try things on an Archos 70 and that shows the same problem as the ZTE Blade where only the tens digit of two digit numbers show. Just mentioning in case there is anything about that tabet and the Blade that give a clue.
  • avoavo Member
    @atilim, I also found one ttf problem. I use calculated x, y for TextField:setPosition(x, y) and some times TextField is distorted in the screen (at win-player and at device). It happens then x coordinate in not integer.
    Yea I noticed this before too I think, atilim was going to add filtering to the TTFont so you could use anti aliasing on it. I'm not sure if it's a Gideros problem or just a side effect of scaling the screen and not having an exact position to place the font. Either way using math.floor or a filtered bitmap font works.

    http://www.giderosmobile.com/forum/discussion/798/font-questions#Item_3
  • AlexRuAlexRu Member
    @avo, thanx. Sometimes it's difficult to search on forum, because I'm not very good in English and it's hard to make a valid request for me :\">
Sign In or Register to comment.