summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorMax <me@mkor.je>2024-10-01 07:59:31 +0000
committerGitHub <noreply@github.com>2024-10-01 07:59:31 +0000
commit75f646c9756634fe6bc7f94349f6496ed0fc5484 (patch)
tree160a97178f84778efddffb00e2ecb0caf6fe8bca /crates
parent1a24b29d86dfe72e0d3c7f79475c187ed4df5e5a (diff)
Fix `math.stretch` not working vertically with attachments (#5069)
Diffstat (limited to 'crates')
-rw-r--r--crates/typst/src/math/stretch.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/typst/src/math/stretch.rs b/crates/typst/src/math/stretch.rs
index d316fa9a..232252b9 100644
--- a/crates/typst/src/math/stretch.rs
+++ b/crates/typst/src/math/stretch.rs
@@ -73,9 +73,15 @@ pub(super) fn stretch_fragment(
_ => return,
};
- let Some(axis) = axis.or_else(|| stretch_axis(ctx, &glyph)) else {
+ // Return if we attempt to stretch along an axis which isn't stretchable,
+ // so that the original fragment isn't modified.
+ let Some(stretch_axis) = stretch_axis(ctx, &glyph) else {
return;
};
+ let axis = axis.unwrap_or(stretch_axis);
+ if axis != stretch_axis {
+ return;
+ }
let relative_to_size = relative_to.unwrap_or_else(|| fragment.size().get(axis));