summaryrefslogtreecommitdiff
path: root/crates/typst-library
diff options
context:
space:
mode:
authordamaxwell <damaxwell@alaska.edu>2023-07-20 02:59:22 -0800
committerGitHub <noreply@github.com>2023-07-20 12:59:22 +0200
commit51a21403ba2e8ced2aeb6a80996d9247f0b7ffd0 (patch)
tree1b1ecb846d72ddc662a1c0165723ce402565e7f4 /crates/typst-library
parentc72952b512f031a20be1455e5168b7e673b25a97 (diff)
Improved #box baselines in math (#1755)
* Improved #box baselines in math * add a test
Diffstat (limited to 'crates/typst-library')
-rw-r--r--crates/typst-library/src/math/mod.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/crates/typst-library/src/math/mod.rs b/crates/typst-library/src/math/mod.rs
index c29ad29b..1b5c27f8 100644
--- a/crates/typst-library/src/math/mod.rs
+++ b/crates/typst-library/src/math/mod.rs
@@ -43,7 +43,7 @@ use self::ctx::*;
use self::fragment::*;
use self::row::*;
use self::spacing::*;
-use crate::layout::{HElem, ParElem, Spacing};
+use crate::layout::{BoxElem, HElem, ParElem, Spacing};
use crate::meta::Supplement;
use crate::meta::{
Count, Counter, CounterUpdate, LocalName, Numbering, Outlinable, Refable,
@@ -480,8 +480,12 @@ impl LayoutMath for Content {
let mut frame = ctx.layout_content(self)?;
if !frame.has_baseline() {
- let axis = scaled!(ctx, axis_height);
- frame.set_baseline(frame.height() / 2.0 + axis);
+ if self.is::<BoxElem>() {
+ frame.set_baseline(frame.height());
+ } else {
+ let axis = scaled!(ctx, axis_height);
+ frame.set_baseline(frame.height() / 2.0 + axis);
+ }
}
ctx.push(FrameFragment::new(ctx, frame).with_spaced(true));