Repository: typst/typst
File: crates/typst-layout/src/math/frac.rs (Rust)

Code before:
    frame.push_frame(denom_pos, denom);

    if binom {
        let short_fall = DELIM_SHORT_FALL.resolve(styles);

        let mut left =
            ctx.layout_into_fragment(&SymbolElem::packed('(').spanned(span), styles)?;
        left.stretch_vertical(ctx, height, short_fall);
        left.center_on_axis();
        ctx.push(left);

        ctx.push(FrameFragment::new(styles, frame));

        let mut right =
            ctx.layout_into_fragment(&SymbolElem::packed(')').spanned(span), styles)?;
        right.stretch_vertical(ctx, height, short_fall);
        right.center_on_axis();
        ctx.push(right);
    } else {
        let text_fill = styles.get_ref(TextElem::fill).as_decoration();
        let line = match styles.get_ref(TextElem::stroke) {
            Some(stroke) => Geometry::Rect(Size::new(line_width, thickness))
                .filled_and_stroked(
                    text_fill.clone(),
                    FixedStroke::from_pair(
                        stroke.paint.clone().unwrap_or(text_fill),
                        stroke.thickness.resolve(styles).unwrap_or(Abs::pt(1.0)),
                    ),
                ),
            None => Geometry::Line(Point::with_x(line_width))
                .stroked(FixedStroke::from_pair(text_fill, thickness)),
        };
        frame.push(line_pos, FrameItem::Shape(line, span));
        ctx.push(FrameFragment::new(styles, frame));
    }

    Ok(())
}

// Lays out a horizontal fraction
fn layout_horizontal_frac(
    ctx: &mut MathContext,
    styles: StyleChain,
    num: &Content,
    denom: &Content,
    span: Span,
    num_deparen: bool,
    denom_deparen: bool,
) -> SourceResult<()> {
    let num = if num_deparen {
        &LrElem::new(Content::sequence(vec![

Review comment (suggestion):
```rust
                .filled_and_stroked(
                    text_fill.clone(),
                    stroke.clone().resolve(styles).unwrap_or_default(),
                ),

```
(It won't let me add a suggested change over deleted lines)

Code after:
    frame.push_frame(denom_pos, denom);

    if binom {
        let short_fall = DELIM_SHORT_FALL.resolve(styles);

        let mut left =
            ctx.layout_into_fragment(&SymbolElem::packed('(').spanned(span), styles)?;
        left.stretch_vertical(ctx, height, short_fall);
        left.center_on_axis();
        ctx.push(left);

        ctx.push(FrameFragment::new(styles, frame));

        let mut right =
            ctx.layout_into_fragment(&SymbolElem::packed(')').spanned(span), styles)?;
        right.stretch_vertical(ctx, height, short_fall);
        right.center_on_axis();
        ctx.push(right);
    } else {
        let text_fill = styles.get_ref(TextElem::fill).as_decoration();
        let line = match styles.get_ref(TextElem::stroke) {
            Some(stroke) => Geometry::Rect(Size::new(line_width, thickness))
                .filled_and_stroked(
                    text_fill.clone(),
                    stroke.clone().resolve(styles).unwrap_or_default(),
                ),
            None => Geometry::Line(Point::with_x(line_width))
                .stroked(FixedStroke::from_pair(text_fill, thickness)),
        };
        frame.push(line_pos, FrameItem::Shape(line, span));
        ctx.push(FrameFragment::new(styles, frame));
    }

    Ok(())
}

// Lays out a horizontal fraction
fn layout_horizontal_frac(
    ctx: &mut MathContext,
    styles: StyleChain,
    num: &Content,
    denom: &Content,
    span: Span,
    num_deparen: bool,
    denom_deparen: bool,
) -> SourceResult<()> {
    let num = if num_deparen {
        &LrElem::new(Content::sequence(vec![
            SymbolElem::packed('('),
            num.clone(),
            SymbolElem::packed(')'),