From bb38a01d0625d5bdab0af50daf479e60c774d90e Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 20 Dec 2024 12:35:57 +0000 Subject: Fix math size resolving (#5596) --- crates/typst-layout/src/math/underover.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'crates/typst-layout/src/math/underover.rs') diff --git a/crates/typst-layout/src/math/underover.rs b/crates/typst-layout/src/math/underover.rs index 1a2c8db6..e5599638 100644 --- a/crates/typst-layout/src/math/underover.rs +++ b/crates/typst-layout/src/math/underover.rs @@ -1,5 +1,5 @@ use typst_library::diag::SourceResult; -use typst_library::foundations::{Content, Packed, StyleChain}; +use typst_library::foundations::{Content, Packed, Resolve, StyleChain}; use typst_library::layout::{Abs, Em, FixedAlignment, Frame, FrameItem, Point, Size}; use typst_library::math::{ OverbraceElem, OverbracketElem, OverlineElem, OverparenElem, OvershellElem, @@ -10,8 +10,8 @@ use typst_library::visualize::{FixedStroke, Geometry}; use typst_syntax::Span; use super::{ - scaled_font_size, stack, style_cramped, style_for_subscript, style_for_superscript, - FrameFragment, GlyphFragment, LeftRightAlternator, MathContext, MathRun, + stack, style_cramped, style_for_subscript, style_for_superscript, FrameFragment, + GlyphFragment, LeftRightAlternator, MathContext, MathRun, }; const BRACE_GAP: Em = Em::new(0.25); @@ -260,7 +260,7 @@ fn layout_underoverline( ); ctx.push( - FrameFragment::new(ctx, styles, frame) + FrameFragment::new(styles, frame) .with_class(content_class) .with_text_like(content_is_text_like) .with_italics_correction(content_italics_correction), @@ -281,11 +281,10 @@ fn layout_underoverspreader( position: Position, span: Span, ) -> SourceResult<()> { - let font_size = scaled_font_size(ctx, styles); - let gap = gap.at(font_size); + let gap = gap.resolve(styles); let body = ctx.layout_into_run(body, styles)?; let body_class = body.class(); - let body = body.into_fragment(ctx, styles); + let body = body.into_fragment(styles); let glyph = GlyphFragment::new(ctx, styles, c, span); let stretched = glyph.stretch_horizontal(ctx, body.width(), Abs::zero()); @@ -321,7 +320,7 @@ fn layout_underoverspreader( LeftRightAlternator::Right, None, ); - ctx.push(FrameFragment::new(ctx, styles, frame).with_class(body_class)); + ctx.push(FrameFragment::new(styles, frame).with_class(body_class)); Ok(()) } -- cgit v1.2.3