Libgdx Wrap Bug

Anything libgdx related goes here!

Libgdx Wrap Bug

Postby tintinger108 » Fri Sep 13, 2019 4:13 pm

Hello!

There is a wrapping issue at libgdx verion 1.9.10.

I set the label like this:

Code: Select all
Label label = new Label()
label.setWidth(800)
label.setText("Automatisch aufgeben")
label.layout()
h = label.getPrefHeight()
label.setHeight(h)


Although there is enough space left, the text gets wrapped around the character "h". Also, the label.getPrefHeight() is wrong. (Screenshot 1)

Very strange is that it works if I use the text "Automatische aufgeben". (Screenshot 2)

Please help! :)

Image
Last edited by tintinger108 on Sat Sep 14, 2019 9:59 am, edited 1 time in total.
tintinger108
 
Posts: 10
Joined: Fri Sep 13, 2019 3:44 pm

Re: Libgdx Wrap Bug

Postby Magnesus » Fri Sep 13, 2019 7:14 pm

Such bugs are usually so random that you can go around them by changing some small detail. Try changing the width of the label a bit. Set it to 805 or 795 for example.
Magnesus
 
Posts: 1698
Joined: Sun Sep 25, 2011 3:50 pm

Re: Libgdx Wrap Bug

Postby tintinger108 » Fri Sep 13, 2019 9:03 pm

Thanks, but this does not help. The game is localized to several languages and I would really appreciate if the "wrap-method" works as promised. I do not want to check the layout of every message box for every language myself.
tintinger108
 
Posts: 10
Joined: Fri Sep 13, 2019 3:44 pm

Re: Libgdx Wrap Bug

Postby Magnesus » Sat Sep 14, 2019 8:59 am

Look into the source code of libgdx then and try to find where the bug happens then report it. Also check if you are using newest libgdx, it might already be fixed.
Magnesus
 
Posts: 1698
Joined: Sun Sep 25, 2011 3:50 pm

Re: Libgdx Wrap Bug

Postby tintinger108 » Sat Sep 14, 2019 11:06 am

I use the latest version. Unfortunately, I am not good in finding bugs in code of other people.

Does anyone know a workaround to solve this problem?
tintinger108
 
Posts: 10
Joined: Fri Sep 13, 2019 3:44 pm

Re: Libgdx Wrap Bug

Postby tomski » Sat Sep 14, 2019 2:42 pm

Provide entire code for layout. Its not 100% clear what you are doing.
tomski
 
Posts: 909
Joined: Wed Jun 26, 2013 6:06 pm

Re: Libgdx Wrap Bug

Postby tintinger108 » Sat Sep 14, 2019 9:15 pm

here is a minimal example project to reproduce the bug:
https://github.com/TechlingerHons/wrap_bug
tintinger108
 
Posts: 10
Joined: Fri Sep 13, 2019 3:44 pm

Re: Libgdx Wrap Bug

Postby tomski » Sun Sep 15, 2019 2:10 am

have you tried to layout twice?
tomski
 
Posts: 909
Joined: Wed Jun 26, 2013 6:06 pm

Re: Libgdx Wrap Bug

Postby tintinger108 » Sun Sep 15, 2019 8:45 am

yes, but did not help.
tintinger108
 
Posts: 10
Joined: Fri Sep 13, 2019 3:44 pm

Re: Libgdx Wrap Bug

Postby QuiIIraven » Sun Sep 15, 2019 6:02 pm

I see you are not calling fill or expand for the label cell.
also you don't have a table and setFillParent true is not called.

I dont know if it is related to that but I used wrapped labels before but in combination with the things mentioned above and for me it always just worked fine.
QuiIIraven
 
Posts: 81
Joined: Sat Jun 02, 2018 4:59 pm

Next

Return to Libgdx

Who is online

Users browsing this forum: MSN [Bot] and 1 guest