Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
TTFont Rendering — Gideros Forum

TTFont Rendering

moopfmoopf Guru
edited November 2012 in Bugs and issues
Hi @atilim,

I believe I've noticed an issue with the rendering from TTFont. Basically if the width of a piece of text falls outside an integer, e.g. 60.5 instead of 60, then the resultant display of the text is blurred slightly. I've had to write a function to check and add 0.25 to the position to resolve this but I thought I should let you know, as the output from Gideros directly should probably be consistent.

Cheers,

Gareth

Likes: bravcm

+1 -1 (+1 / -0 )Share on Facebook

Comments

  • It also seems to be happening in the base resolution if the width is an odd number. Just trying to absolutely confirm that now.
  • I don't appear to be able to write a function to pad that works in all circumstances - I'm always left with some strings blurring. It's looking to me like there needs to be a change to the way TextField renders to ensure that whole numbers (or probably more likely even numbers if my understanding is correctly) are used for the width and height, which will probably require internal padding on the returned TextField to ensure that's the case.

    Any thoughts you have on this @atilim would be appreciated. In pixel perfect mode it's really obvious when a text string is blurred :(
  • @moopf did you use font filtering:
    local font = TTFont.new("myfont.ttf", 20, true)
  • Hi @ar2rsawseen - of course :) This is an issue with widths (and possibly heights) on the returned TextField object falling between pixels which causes it to be rendered blurred.

    It's actually not a problem that's particularly unique to Gideros - I encountered a similar issue when using cocos2d-iphone and bitmap fonts and there I altered the size of a character I didn't use (and made sure the texture was blank) and padded a string with it to ensure even numbered widths on a returned string. Unfortunately a similar method here doesn't appear to be working.

    I always use even widths and heights on all my textures (and ensure that resized assets will still have even widths and heights) as it's in inherent problem in rendering.
  • Hi again @ar2rsawseen - think I've got a bit further now. In Gideros it actually appears to be a problem that's made worse setting the anchor point to the center or right (GiderosCodingEasy) or manually setting the TextField to the center or right of a parent object by working out widths and positioning that way. And it only happens on some strings, not all, so I think it's width dependant.

    So it's currently a bit of a mess. I'm not sure I can sort this out either by altering the position or padding the TextField object with a dummy image. I can make it better but there are still problems.

    Font rendering is always more of a pain than in should be, regardless of development system used.
  • moopfmoopf Guru
    edited November 2012
    Nope, it's going to have to be looked at by the Gideros team from what I can work out. I can have two strings with the same reported widths and heights, yet one will display blurred and the other not. And that's not having altered any anchor points and that's also in the base resolution. There's something in the black box that i can't rectify from outside it :)

    I'm going to leave this, wasted hours trying to rectify the rendering this morning.
  • I ran into this problem just the other day. (I was using GiderosCodingEasy's setAnchorPoint() on the TextField to center it within a parent Sprite.) I changed my :setAnchorPoint() to 0.48, 0.48 so it would return an even value. Not a fix, but a quick workaround until someone comes up with something better. hehe
  • It's not just about setting it to center, happens when anchors are 0,0 as well. It's hopefully something relatively straightforward to solve.
Sign In or Register to comment.