diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-02-02 16:47:10 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-02-02 16:47:10 +0100 |
| commit | e9ff2d6463bf26cb0bbafb747bf8a77800687e3f (patch) | |
| tree | 810d28ba35557acacf987d08c2000e2e643cbe4e /library/src/math/delimited.rs | |
| parent | e6400861ab5c4d7ab437901b2334e5822c2693a5 (diff) | |
More robust automatic math spacing
Diffstat (limited to 'library/src/math/delimited.rs')
| -rw-r--r-- | library/src/math/delimited.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/library/src/math/delimited.rs b/library/src/math/delimited.rs index cdd5718c..b69e4c39 100644 --- a/library/src/math/delimited.rs +++ b/library/src/math/delimited.rs @@ -60,10 +60,9 @@ impl LayoutMath for LrNode { } } - let mut row = ctx.layout_row(body)?; + let mut fragments = ctx.layout_fragments(body)?; let axis = scaled!(ctx, axis_height); - let max_extent = row - .0 + let max_extent = fragments .iter() .map(|fragment| (fragment.ascent() - axis).max(fragment.descent() + axis)) .max() @@ -75,7 +74,7 @@ impl LayoutMath for LrNode { .resolve(ctx.styles()) .relative_to(2.0 * max_extent); - match row.0.as_mut_slice() { + match fragments.as_mut_slice() { [one] => scale(ctx, one, height, None), [first, .., last] => { scale(ctx, first, height, Some(MathClass::Opening)); @@ -84,7 +83,7 @@ impl LayoutMath for LrNode { _ => {} } - ctx.extend(row); + ctx.extend(fragments); Ok(()) } |
