Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
TextWrap word alignment problem - Gideros Forum

TextWrap word alignment problem

emreemre Member
edited August 2013 in Plugins
Hii, I have problem on TextWrap plugin,
On some words horizontal alignments are broken.
Please look at the attachment.
I could not upload the font used. But I tried another fonts also, same problem exist.

Thanks for your advise.
	local layer = Popup.new({easing = conf.easing})
	layer:setFillStyle(Shape.SOLID, 0x0000ff, 0.5)
	layer:setLineStyle(5, 0x000000)
	layer:setPosition(conf.width/2, conf.height/2)
	local helpDesc = TextWrap.new("Lorem ipsum a dolor sit amet, consectetur adipiscing elit. Morbi ultrices varius tortor. Donec dui nunc, mollis eu dignissim ut, vestibulum vel nunc. Etiam odio est, facilisis imperdiet lacus ut, suscipit bibendum tellus. Ut bibendum elementum a tortor molestie cursus. Lorem a ipsum dolor sit amet, consectetur adipiscing elit. Nullam ut elementum arcu. Fusce mollis eros sapien, sed dictum libero dapibus eget. In bibendum eleifend convallis. Nulla facilisi. ", textWidth, "justify", 5, conf.descriptionFont)
	helpDesc:setPosition(-layer:getWidth()/2 + 30, -layer:getHeight()/2 + 150)
485 x 806 - 160K


  • It is not about textwrap. I have this bug for textfields too. Even if textfield has only 1 character - it can "jump" or "fall"
  • emreemre Member
    It is serious problem. I hope there is a fix of it.
  • Hmm, does it happen with any font, or with some fonts?
    May it be related to half pixel positioning? Like positioning text to 10.5 pixel
  • I think it is possible.
  • emreemre Member
    I updated the codes now I do not use decimal points on positioning(using math.floor),
    And I try tahoma.ttf and again I get the misaligned texts on textwrap.

    598 x 958 - 243K
  • emreemre Member
    I remove game files and only include Help page. Please look at the help page into the attachment project.
    I think problem is on game template scale parts. But since I am a newbie, probably it is not related with that.

    Thanks for your advise.
  • talistalis Guru
    Accepted Answer
    Hi @emre,
    I solved alignment problem by changing TextWrap class to Atilim's version. See the attached project of yours and see the change in Textwrap.lua and help.lua.
  • ar2rsawseenar2rsawseen Maintainer
    edited August 2013
    @emre the issue seems to be with TextWrap after all, because if I set alignment to left the text seems to be ok, let me look at it more ;)

    EDIT: or you can use @talis provided version :)
  • emreemre Member
    Thanks @talis and @ar2rsawseen,
    I am using Atilim's version. But I can not see 'justify' option on TextWrap class.
    Is it implemented?
  • talistalis Guru
    edited August 2013
    @emre it has 3 variants as alignment; left ,right and center.
    see here it is the 6th paremeter:
    local title = TextWrap2.new("How To Play?",textWidth,800,16,1, "left",conf.descriptionTitleFont)
  • I think I know where the problem is, it is combination of GiderosCodingEasy and TextWrap that causes it. I will try to come up with the solution tonight ;)
  • Here's is your project with modified GiderosCodingEasy and TextWrap classes to make it work correctly. Meanwhile I'll update the repos ;)

    Likes: talis

    +1 -1 (+1 / -0 ) Share on Facebook
  • I'll have to get back into my game soon, as this was one issue that was holding me back from finishing.
  • Apollo14Apollo14 Member
    edited March 13
    Unfortunately 'TextWrap' class is buggy as hell atm, on some phrases horizontal alignment is totally broken.

    For example phrase "Certainly\nyes" aligns perfectly, while phrase "Most\nlikely" for some reason shifts to the right.
    Did somebody find a solution how to centrify multiline textfields?
    Sometimes it centrifies text, sometimes it shifts it to the right, depends on God knows what:
    answerTxt = TextWrap.new("No", 186, "center")
    P. S. it is supposed to be on center:
    1080 x 1920 - 226K
  • Apollo14Apollo14 Member
    edited March 13
    Not possible to create a very simple app just because of that, that's annoying. :s :'(
    Guys can you check attached project, is there a solution how to centrify text?
    Neither TextWrap nor TextArea is of any help :s
    Is there a bug in TextWrap/TextArea or somewhere in the very engine itself?
  • hgy29hgy29 Maintainer
    Maybe try with TextField and it’s new layout abilities ?
    +1 -1 (+2 / -0 ) Share on Facebook
  • hgy29 said:

    Maybe try with TextField and it’s new layout abilities ?

    I'd be happy to do it! Thx!
    How do new layout abilities work? I didn't find any examples now.
  • piepie Member
    @Apollo14 textwrap has not been updated in a long time and I suppose it broke when multiline textField was added.

  • Apollo14Apollo14 Member
    edited March 14
    @pie thx! now it aligns well with 'FontBase.TLF_CENTER': :)
    answerTxt = TextField.new(impact, "Ask a\nquestion", "", {w=200, h=100, lineSpacing=7, flags=FontBase.TLF_CENTER})

    Likes: totebo

    +1 -1 (+1 / -0 ) Share on Facebook
Sign In or Register to comment.