summaryrefslogtreecommitdiff
path: root/library/src/math
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-25 10:36:31 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-25 12:16:13 +0100
commitbf5edbbbbb75120d065d1c9587ccfa4eed4fdca1 (patch)
tree956af910ab27a8cec0db83171cd3f0b6d0570a60 /library/src/math
parent96f72eee6c6b595164c7a0576c407d7a590661db (diff)
Tidy up
Diffstat (limited to 'library/src/math')
-rw-r--r--library/src/math/mod.rs12
-rw-r--r--library/src/math/tex.rs2
2 files changed, 8 insertions, 6 deletions
diff --git a/library/src/math/mod.rs b/library/src/math/mod.rs
index 1ea03d70..3b1d66e9 100644
--- a/library/src/math/mod.rs
+++ b/library/src/math/mod.rs
@@ -4,6 +4,8 @@ mod tex;
use std::fmt::Write;
+use typst::model::Guard;
+
use self::tex::{layout_tex, Texify};
use crate::prelude::*;
use crate::text::FontFamily;
@@ -28,21 +30,21 @@ impl MathNode {
}
impl Show for MathNode {
- fn show(&self, _: Tracked<dyn World>, styles: StyleChain) -> SourceResult<Content> {
+ fn show(&self, _: Tracked<dyn World>, styles: StyleChain) -> Content {
let mut map = StyleMap::new();
map.set_family(FontFamily::new("NewComputerModernMath"), styles);
let mut realized = self
.clone()
.pack()
- .guarded(RecipeId::Base(NodeId::of::<Self>()))
+ .guarded(Guard::Base(NodeId::of::<Self>()))
.styled_with_map(map);
if self.display {
realized = realized.aligned(Axes::with_x(Some(Align::Center.into())))
}
- Ok(realized)
+ realized
}
}
@@ -50,10 +52,10 @@ impl LayoutInline for MathNode {
fn layout_inline(
&self,
world: Tracked<dyn World>,
- _: &Regions,
styles: StyleChain,
+ _: &Regions,
) -> SourceResult<Frame> {
- layout_tex(&self.texify(), self.display, world, styles)
+ layout_tex(world, &self.texify(), self.display, styles)
}
}
diff --git a/library/src/math/tex.rs b/library/src/math/tex.rs
index ffde719b..a85bab18 100644
--- a/library/src/math/tex.rs
+++ b/library/src/math/tex.rs
@@ -35,9 +35,9 @@ impl Texify for Content {
/// Layout a TeX formula into a frame.
pub fn layout_tex(
+ world: Tracked<dyn World>,
tex: &str,
display: bool,
- world: Tracked<dyn World>,
styles: StyleChain,
) -> SourceResult<Frame> {
// Load the font.