bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Ui Text does not word wrap if next "word" begins with a dot

Open porkbrain opened this issue 1 year ago • 4 comments

Bevy version

0.13

What you did

I have a text that ends with three dots.

What went wrong

The three dots overflow the text node. I have word wrapping and clipping in both axes set. The red box is the height and width of the text node child. The parent is the much bigger bubble image.

no_clip

As long as the word starts with a dot, it's not wrapped.

no_clip_more_space_has_letter

Finally wraps when leading dot is removed.

clip_when_starts_with_letter

porkbrain avatar Feb 24 '24 19:02 porkbrain

I did some investigation of this upstream at https://github.com/alexheretic/glyph-brush/issues/174 and confirmed that #10193 won't help with this.

Though I closed that issue, it seems like Bevy or the library it is using for text layout should behave better. I tested a bunch of browsers and they don't seem to have this issue, though I suspect they are varying their wrapping behavior based on container/text size or something fancy.

rparrett avatar Feb 26 '24 21:02 rparrett

As a dirty workaround, you might be able to explicitly add soft break opportunities to your text by inserting \u{200B} (zero-width space) characters.

rparrett avatar Feb 26 '24 21:02 rparrett

Thank you for the investigation and suggestion!

porkbrain avatar Feb 27 '24 01:02 porkbrain

Unfortunately, it looks like cosmic-text did not save us. This still seems to be an issue.

rparrett avatar Jul 13 '24 21:07 rparrett