Skip to content

Commit 80aea5a

Browse files
committed
Skia: Fix no-wrap still wrapping text sometimes
Fixes #7080
1 parent a66aa2d commit 80aea5a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

internal/renderers/skia/textlayout.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,16 @@ pub fn create_layout(
162162
let mut paragraph = builder.build();
163163
paragraph.layout(max_width.map_or(f32::MAX, |physical_width| physical_width.get()));
164164

165+
// If without line breaking the text would be longer than the given max_width, lay out again
166+
// without line breaks.
167+
if wrap == items::TextWrap::NoWrap || overflow == items::TextOverflow::Elide {
168+
if let Some(physical_width) = max_width {
169+
if paragraph.max_intrinsic_width() > physical_width.get() {
170+
paragraph.layout(f32::MAX);
171+
}
172+
}
173+
}
174+
165175
let layout_height = PhysicalLength::new(paragraph.height());
166176

167177
let layout_top_y = match v_align {

0 commit comments

Comments
 (0)