mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-31 15:47:26 +00:00
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:
parent
476abf4951
commit
5cad61bcd0
6 changed files with 91 additions and 25 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue