From bf5edbbbbb75120d065d1c9587ccfa4eed4fdca1 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 25 Nov 2022 10:36:31 +0100 Subject: Tidy up --- library/src/math/mod.rs | 12 +++++++----- library/src/math/tex.rs | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'library/src/math') 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, styles: StyleChain) -> SourceResult { + fn show(&self, _: Tracked, 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::())) + .guarded(Guard::Base(NodeId::of::())) .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, - _: &Regions, styles: StyleChain, + _: &Regions, ) -> SourceResult { - 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, tex: &str, display: bool, - world: Tracked, styles: StyleChain, ) -> SourceResult { // Load the font. -- cgit v1.2.3