@@ -220,7 +220,7 @@ fn rows_from_paragraphs(
220
220
} ) ;
221
221
} else {
222
222
let paragraph_max_x = paragraph. glyphs . last ( ) . unwrap ( ) . max_x ( ) ;
223
- if paragraph_max_x <= job. wrap . max_width {
223
+ if paragraph_max_x <= job. effective_wrap_width ( ) {
224
224
// Early-out optimization: the whole paragraph fits on one row.
225
225
let paragraph_min_x = paragraph. glyphs [ 0 ] . pos . x ;
226
226
rows. push ( Row {
@@ -241,11 +241,7 @@ fn rows_from_paragraphs(
241
241
}
242
242
243
243
fn line_break ( paragraph : & Paragraph , job : & LayoutJob , out_rows : & mut Vec < Row > , elided : & mut bool ) {
244
- let wrap_width_margin = if job. round_output_size_to_nearest_ui_point {
245
- 0.5
246
- } else {
247
- 0.0
248
- } ;
244
+ let wrap_width = job. effective_wrap_width ( ) ;
249
245
250
246
// Keeps track of good places to insert row break if we exceed `wrap_width`.
251
247
let mut row_break_candidates = RowBreakCandidates :: default ( ) ;
@@ -262,7 +258,7 @@ fn line_break(paragraph: &Paragraph, job: &LayoutJob, out_rows: &mut Vec<Row>, e
262
258
263
259
let potential_row_width = paragraph. glyphs [ i] . max_x ( ) - row_start_x;
264
260
265
- if job . wrap . max_width + wrap_width_margin < potential_row_width {
261
+ if wrap_width < potential_row_width {
266
262
// Row break:
267
263
268
264
if first_row_indentation > 0.0
@@ -420,7 +416,7 @@ fn replace_last_glyph_with_overflow_character(
420
416
} ) ;
421
417
}
422
418
423
- if row_width ( row) <= job. wrap . max_width || row. glyphs . len ( ) == 1 {
419
+ if row_width ( row) <= job. effective_wrap_width ( ) || row. glyphs . len ( ) == 1 {
424
420
return ; // we are done
425
421
}
426
422
@@ -467,7 +463,7 @@ fn replace_last_glyph_with_overflow_character(
467
463
}
468
464
469
465
// Check if we're within width budget:
470
- if row_width ( row) <= job. wrap . max_width || row. glyphs . len ( ) == 1 {
466
+ if row_width ( row) <= job. effective_wrap_width ( ) || row. glyphs . len ( ) == 1 {
471
467
return ; // We are done
472
468
}
473
469
@@ -653,8 +649,8 @@ fn galley_from_rows(
653
649
// If the user picked a too aggressive wrap width (e.g. more narrow than any individual glyph),
654
650
// we should let the user know.
655
651
} else {
656
- // Make sure we don't over the max wrap width the user picked:
657
- rect. max . x = rect. max . x . at_most ( rect. min . x + job. wrap . max_width ) ;
652
+ // Make sure we don't go over the max wrap width the user picked:
653
+ rect. max . x = rect. max . x . at_most ( rect. min . x + job. wrap . max_width ) . floor ( ) ;
658
654
}
659
655
}
660
656
0 commit comments