summaryrefslogtreecommitdiff
path: root/library/src/math/root.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-03-12 12:53:50 +0100
committerLaurenz <laurmaedje@gmail.com>2023-03-12 13:20:36 +0100
commitad05ba59256a67f429b71a8aba2cd92ed2cafac7 (patch)
tree019ccf26f7308d907c042624ccbb647f76d3491b /library/src/math/root.rs
parent2720a44b965d29e9c3453c732e38554fdb6413bb (diff)
Spans in math
Diffstat (limited to 'library/src/math/root.rs')
-rw-r--r--library/src/math/root.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/library/src/math/root.rs b/library/src/math/root.rs
index cb01e6a1..1ab99b2b 100644
--- a/library/src/math/root.rs
+++ b/library/src/math/root.rs
@@ -18,7 +18,7 @@ pub struct SqrtNode {
impl LayoutMath for SqrtNode {
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
- layout(ctx, None, &self.radicand())
+ layout(ctx, None, &self.radicand(), self.span())
}
}
@@ -44,7 +44,7 @@ pub struct RootNode {
impl LayoutMath for RootNode {
fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> {
- layout(ctx, Some(&self.index()), &self.radicand())
+ layout(ctx, Some(&self.index()), &self.radicand(), self.span())
}
}
@@ -55,6 +55,7 @@ fn layout(
ctx: &mut MathContext,
mut index: Option<&Content>,
radicand: &Content,
+ span: Span,
) -> SourceResult<()> {
let gap = scaled!(
ctx,
@@ -80,7 +81,7 @@ fn layout(
frame
})
.unwrap_or_else(|| {
- let glyph = GlyphFragment::new(ctx, '√');
+ let glyph = GlyphFragment::new(ctx, '√', span);
glyph.stretch_vertical(ctx, target, Abs::zero()).frame
});
@@ -145,7 +146,7 @@ fn precomposed(ctx: &MathContext, index: Option<&Content>, target: Abs) -> Optio
};
ctx.ttf.glyph_index(c)?;
- let glyph = GlyphFragment::new(ctx, c);
+ let glyph = GlyphFragment::new(ctx, c, node.span());
let variant = glyph.stretch_vertical(ctx, target, Abs::zero()).frame;
if variant.height() < target {
return None;