Fix text wrapping issue

This commit is contained in:
Joscha 2024-03-08 18:09:47 +01:00
parent 1e73c01845
commit 62c4cc8f26

View file

@ -111,6 +111,12 @@ impl<C: HasFontStuff> Widget<C> for Text {
.max_by(|a, b| a.partial_cmp(b).unwrap()) .max_by(|a, b| a.partial_cmp(b).unwrap())
.unwrap_or(0.0); .unwrap_or(0.0);
// If we don't round up here, the layout rounding may round down our
// size slightly. This may lead to more line breaks, moving some words
// below our visible area.
let width = width.ceil();
let height = height.ceil();
Size { width, height } Size { width, height }
} }