Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions crates/bevy_text/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ impl TextPipeline {

// Update the buffer.
let buffer = &mut computed.buffer;
buffer.set_size(font_system, bounds.width, bounds.height);

buffer.set_wrap(
font_system,
Expand All @@ -213,11 +212,10 @@ impl TextPipeline {

// Workaround for alignment not working for unbounded text.
// See https://github.com/pop-os/cosmic-text/issues/343
if bounds.width.is_none() && justify != Justify::Left {
let dimensions = buffer_dimensions(buffer);
// `set_size` causes a re-layout to occur.
buffer.set_size(font_system, Some(dimensions.x), bounds.height);
}
let width = (bounds.width.is_none() && justify != Justify::Left)
.then(|| buffer_dimensions(buffer).x)
.or(bounds.width);
buffer.set_size(font_system, width, bounds.height);

// Recover the spans buffer.
spans.clear();
Expand Down