diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-01-29 17:53:25 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-01-29 17:53:25 +0100 |
| commit | e4e888b9ce361616545da319170c61d2d8878a59 (patch) | |
| tree | 3930a492636b5f27cbb01f274fad6c5dd9a00c93 /library/src | |
| parent | 17f8939f8631104737b928ddeebb401134da1f6e (diff) | |
Fix `lr` with already matched body
Diffstat (limited to 'library/src')
| -rw-r--r-- | library/src/math/lr.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/library/src/math/lr.rs b/library/src/math/lr.rs index e265affb..2eb567b9 100644 --- a/library/src/math/lr.rs +++ b/library/src/math/lr.rs @@ -53,8 +53,14 @@ impl LrNode { impl LayoutMath for LrNode { fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { - let mut row = ctx.layout_row(&self.body)?; + let mut body = &self.body; + if let Some(node) = self.body.to::<LrNode>() { + if node.size.is_none() { + body = &node.body; + } + } + let mut row = ctx.layout_row(body)?; let axis = scaled!(ctx, axis_height); let max_extent = row .0 @@ -95,7 +101,12 @@ fn scale( fragment.class(), Some(MathClass::Opening | MathClass::Closing | MathClass::Fence) ) { - let MathFragment::Glyph(glyph) = *fragment else { return }; + let glyph = match fragment { + MathFragment::Glyph(glyph) => *glyph, + MathFragment::Variant(variant) => GlyphFragment::new(ctx, variant.c), + _ => return, + }; + let short_fall = DELIM_SHORT_FALL.scaled(ctx); *fragment = MathFragment::Variant(glyph.stretch_vertical(ctx, height, short_fall)); |
