You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each BufferLine/ShapeLine determines its own width, then it is "centred" within its own line.
But when it's unbounded, the text's width is of course the line's width (there is no line breaking), so there's no alignment correction at all.
The intention is a little unclear. When you first set up the Buffer, it requires providing an alignment (Buffer-level alignment), but currently, cosmic-text supports mixed alignment within one Buffer, since each BufferLine has a set_align method.
That is, currently cosmic-text supports this display in a single Buffer:
left align |
right align|
center align |
Ideally the alignment would be Buffer-level, and apply after the shaping (after you know the width of the whole buffer) but that wouldn't support mixed alignment.
But an application could instead support mixed alignment through stacking multiple Buffers:
left align |
right align|
center align |
I'm not sure how well the post-shaping alignment works with the incremental approach.
I'm debugging bevyengine/bevy#16783 and it seems like it might be an issue here with
cosmic-text
.We've worked around this on our end by doing a re-layout with bounds determined from the first pass, but it's not ideal performance-wise.
Testing against 1ab7fc2, but Bevy is using
cosmic-text
0.12
.Expand Code
What went wrong
When the buffer is unbounded, text is always left aligned.
The code above lays out the following text:
With
Align::Center
set with eitherset_rich_text
or on each line withset_align
.Things seem to work as expected when there are bounds.
But when the buffer is unbounded, the text is left-aligned.
The text was updated successfully, but these errors were encountered: