summaryrefslogtreecommitdiff
path: root/crates/typst-layout/src/math/attach.rs
diff options
context:
space:
mode:
authorMax <me@mkor.je>2024-12-20 12:35:57 +0000
committerGitHub <noreply@github.com>2024-12-20 12:35:57 +0000
commitbb38a01d0625d5bdab0af50daf479e60c774d90e (patch)
treeb588b09ce44b698e7602d84ec3e43dd86a47b552 /crates/typst-layout/src/math/attach.rs
parent39706fe42f269b3a283eeff9b595480631737159 (diff)
Fix math size resolving (#5596)
Diffstat (limited to 'crates/typst-layout/src/math/attach.rs')
-rw-r--r--crates/typst-layout/src/math/attach.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/crates/typst-layout/src/math/attach.rs b/crates/typst-layout/src/math/attach.rs
index cda03315..263fc5c6 100644
--- a/crates/typst-layout/src/math/attach.rs
+++ b/crates/typst-layout/src/math/attach.rs
@@ -1,6 +1,6 @@
use typst_library::diag::SourceResult;
-use typst_library::foundations::{Packed, Smart, StyleChain};
-use typst_library::layout::{Abs, Axis, Corner, Frame, Length, Point, Rel, Size};
+use typst_library::foundations::{Packed, StyleChain};
+use typst_library::layout::{Abs, Axis, Corner, Frame, Point, Rel, Size};
use typst_library::math::{
AttachElem, EquationElem, LimitsElem, PrimesElem, ScriptsElem, StretchElem,
};
@@ -121,7 +121,7 @@ pub fn layout_primes(
prime.clone(),
)
}
- ctx.push(FrameFragment::new(ctx, styles, frame).with_text_like(true));
+ ctx.push(FrameFragment::new(styles, frame).with_text_like(true));
}
}
Ok(())
@@ -154,11 +154,8 @@ pub fn layout_limits(
Ok(())
}
-/// Get the size to stretch the base to, if the attach argument is true.
-fn stretch_size(
- styles: StyleChain,
- elem: &Packed<AttachElem>,
-) -> Option<Smart<Rel<Length>>> {
+/// Get the size to stretch the base to.
+fn stretch_size(styles: StyleChain, elem: &Packed<AttachElem>) -> Option<Rel<Abs>> {
// Extract from an EquationElem.
let mut base = elem.base();
while let Some(equation) = base.to_packed::<EquationElem>() {
@@ -277,7 +274,7 @@ fn layout_attachments(
layout!(b, b_x, b_y); // lower-limit
// Done! Note that we retain the class of the base.
- ctx.push(FrameFragment::new(ctx, styles, frame).with_class(base_class));
+ ctx.push(FrameFragment::new(styles, frame).with_class(base_class));
Ok(())
}