diff --git a/crates/bevy_text/src/pipeline.rs b/crates/bevy_text/src/pipeline.rs index 08d98e8dbea14..a3156a3ee0cd4 100644 --- a/crates/bevy_text/src/pipeline.rs +++ b/crates/bevy_text/src/pipeline.rs @@ -315,9 +315,11 @@ impl TextPipeline { } let buffer = &mut computed.buffer; - let box_size = buffer_dimensions(buffer); + let mut box_size = Vec2::ZERO; let result = buffer.layout_runs().try_for_each(|run| { + box_size.x = box_size.x.max(run.line_w); + box_size.y += run.line_height; let mut current_section: Option = None; let mut start = 0.; let mut end = 0.; @@ -443,7 +445,7 @@ impl TextPipeline { // Check result. result?; - layout_info.size = box_size; + layout_info.size = box_size.ceil(); Ok(()) } @@ -553,9 +555,11 @@ impl TextPipeline { let buffer = &mut computed.buffer; buffer.set_size(font_system, bounds.width, bounds.height); - let box_size = buffer_dimensions(buffer); + let mut box_size = Vec2::ZERO; let result = buffer.layout_runs().try_for_each(|run| { + box_size.x = box_size.x.max(run.line_w); + box_size.y += run.line_height; let mut current_section: Option = None; let mut start = 0.; let mut end = 0.;