Fix disappearing text in vertical layouts with word-wrap and alignment

When a Text element has wrapping enabled, it should not have zero
minimum size. Otherwise the layout will give it a height of zero in the
layout in the test case and that'll make the text disappear. There are
different options but this patch goes for minimum height as if no
wrapping was enabled (so at least one line plus forced line breaks).

Fixes #246
This commit is contained in:
Simon Hausmann 2021-05-28 14:25:09 +02:00 committed by Simon Hausmann
parent 476abf4951
commit 5cad61bcd0
6 changed files with 91 additions and 25 deletions

View file

@ -159,6 +159,10 @@ impl FontMetrics for TestingFontMetrics {
Size::new(text.len() as f32 * 10., 10.)
}
fn line_height(&self) -> f32 {
10.
}
fn text_offset_for_x_position(&self, _text: &str, _x: f32) -> usize {
0
}