diff --git a/crates/typst-layout/src/math/fragment.rs b/crates/typst-layout/src/math/fragment.rs index 87817235b..2f87e99f1 100644 --- a/crates/typst-layout/src/math/fragment.rs +++ b/crates/typst-layout/src/math/fragment.rs @@ -437,6 +437,8 @@ impl GlyphFragment { /// /// The resulting frame may not have the exact desired width or height. pub fn stretch(&mut self, ctx: &mut MathContext, target: Abs, axis: Axis) { + self.reset_glyph(); + // If the base glyph is good enough, use it. let mut advance = self.size.get(axis); if axis == Axis::X && !self.extended_shape { diff --git a/crates/typst-layout/src/math/stretch.rs b/crates/typst-layout/src/math/stretch.rs index 02ee1f6cb..373e249c3 100644 --- a/crates/typst-layout/src/math/stretch.rs +++ b/crates/typst-layout/src/math/stretch.rs @@ -60,8 +60,6 @@ pub fn stretch_fragment( } }; - glyph.reset_glyph(); - let relative_to_size = relative_to.unwrap_or_else(|| size.get(stretch_axis)); glyph.stretch(ctx, stretch.relative_to(relative_to_size) - short_fall, stretch_axis);