@@ -472,6 +472,7 @@ impl<'a, B: Brush> BreakLines<'a, B> {
472
472
// Default vertical alignment is to align the bottom of boxes with the text baseline.
473
473
// This is equivalent to the entire height of the box being "ascent"
474
474
line. metrics . ascent = line. metrics . ascent . max ( item. height ) ;
475
+ line. metrics . line_height = line. metrics . line_height . max ( item. height ) ;
475
476
476
477
// Mark us as having seen non-whitespace content on this line
477
478
have_metrics = true ;
@@ -504,12 +505,10 @@ impl<'a, B: Brush> BreakLines<'a, B> {
504
505
// Compute the run's vertical metrics
505
506
let run = & self . layout . runs [ line_item. index ] ;
506
507
let line_height = line_item. compute_line_height ( self . layout ) ;
507
- line. metrics . ascent =
508
- line. metrics . ascent . max ( run. metrics . ascent * line_height) ;
509
- line. metrics . descent =
510
- line. metrics . descent . max ( run. metrics . descent * line_height) ;
511
- line. metrics . leading =
512
- line. metrics . leading . max ( run. metrics . leading * line_height) ;
508
+ line. metrics . line_height = line. metrics . line_height . max ( line_height) ;
509
+ line. metrics . ascent = line. metrics . ascent . max ( run. metrics . ascent ) ;
510
+ line. metrics . descent = line. metrics . descent . max ( run. metrics . descent ) ;
511
+ line. metrics . leading = line. metrics . leading . max ( run. metrics . leading ) ;
513
512
514
513
// Mark us as having seen non-whitespace content on this line
515
514
have_metrics = true ;
@@ -559,7 +558,9 @@ impl<'a, B: Brush> BreakLines<'a, B> {
559
558
// Round block/vertical axis metrics
560
559
line. metrics . ascent = line. metrics . ascent . round ( ) ;
561
560
line. metrics . descent = line. metrics . descent . round ( ) ;
562
- line. metrics . leading = ( line. metrics . leading * 0.5 ) . round ( ) * 2. ;
561
+ line. metrics . line_height = line. metrics . line_height . round ( ) ;
562
+ line. metrics . leading =
563
+ line. metrics . line_height - ( line. metrics . ascent + line. metrics . descent ) ;
563
564
564
565
// Compute
565
566
let above = ( line. metrics . ascent + line. metrics . leading * 0.5 ) . round ( ) ;
0 commit comments