Skip to content

Commit e29823d

Browse files
committed
fix: issue with text wrapping
1 parent 84af9a3 commit e29823d

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

litehtml/src/pixbuf.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,11 @@ impl DocumentContainer for PixbufContainer {
445445

446446
let mut fs = self.font_system.borrow_mut();
447447
let mut buffer = cosmic_text::Buffer::new(&mut fs, ct_metrics);
448-
buffer.set_size(
449-
&mut fs,
450-
Some(pos.width.min(f32::MAX / 2.0)),
451-
Some(line_height),
452-
);
448+
// Use unconstrained width so cosmic-text doesn't re-wrap. litehtml
449+
// already sized and positioned each text run; rounding in pos.round()
450+
// can shave fractional pixels off pos.width, causing the last glyph(s)
451+
// to wrap onto an invisible second line.
452+
buffer.set_size(&mut fs, Some(f32::MAX), Some(line_height));
453453
buffer.set_text(&mut fs, text, &attrs, Shaping::Advanced);
454454
buffer.shape_until_scroll(&mut fs, false);
455455

0 commit comments

Comments
 (0)