tommyettinger / textratypist

Augmented text display system for libGDX, based on typing-label
Apache License 2.0
94 stars 9 forks source link

BUG: Line wrapping with `Align.center` is wrong for `TextraLabel` #6

Closed Daniikk1012 closed 2 years ago

Daniikk1012 commented 2 years ago

This is how it looks like:

изображение

This is how it is supposed to look like (In this image TypingLabel is used, seems like the issue does not exist for it):

изображение

tommyettinger commented 2 years ago

This is an interesting one... The wrap width also seems smaller for that TypingLabel. This is using the latest release, 0.7.1 ? I'll try to verify over here and track down what might be causing this.

tommyettinger commented 2 years ago

There's now a test that tries to replicate this, though I don't know all of the code involved with the buggy original screenshot. I can replicate now (I tried with manual newlines originally, and hadn't enabled wrapping), and I get it looking similar to your screenshot:

Off to the left...

I think I know what is involved here, though I'm not 100% sure yet.

The rest is old, disregard

The test looks like this with TextraLabel, and the same with TypingLabel: Centered...

It's quite likely that there's some corner-case bug somewhere in the library, because that type of bug seems to pop up like a weed... Maybe you encountered the bug in a scene2d.ui Cell that contained a TextraLabel, rather than a TextraLabel on its own like in Issue6Test?

tommyettinger commented 2 years ago

This might be fixed by the latest commit:

Fixed?

You can try it yourself using a JitPack dependency; I'd really like to know if this fixes the bug in your case. https://jitpack.io/#tommyettinger/textratypist/7168f0590c

A potential issue here is that TypingLabel seems to wrap more frequently (with less space permitted for the words) than TextraLabel. I'm not sure what's happening other than a possible difference between the two methods that can do word wrapping.

Daniikk1012 commented 2 years ago

Thanks, I'll try it and tell you if it fixes the issue.

About wrapping more frequently - it is probably due to the fact that the width of my TypingLabel is just smaller than yours, so it is no surprise.

Daniikk1012 commented 2 years ago

Seems to be working, closing the issue