From d1e936fb2551d75ff9d54dc63e38d6e6eaeb8131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Sat, 12 Apr 2025 00:48:57 +0200 Subject: [PATCH] Re-align `Paragraph` on resize Fixes #2888 --- graphics/src/text/paragraph.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/graphics/src/text/paragraph.rs b/graphics/src/text/paragraph.rs index 3432ab73..9cda9cb0 100644 --- a/graphics/src/text/paragraph.rs +++ b/graphics/src/text/paragraph.rs @@ -186,7 +186,8 @@ impl core::text::Paragraph for Paragraph { Some(new_bounds.height), ); - let (min_bounds, _has_rtl) = text::measure(¶graph.buffer); + let min_bounds = + align(&mut paragraph.buffer, &mut font_system, paragraph.align_x); paragraph.bounds = new_bounds; paragraph.min_bounds = min_bounds; @@ -376,6 +377,8 @@ fn align( } needs_relayout = true; + } else if let Some(line) = buffer.lines.first_mut() { + needs_relayout = line.set_align(None); } }