diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-11-28 12:40:16 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-11-28 12:40:16 +0100 |
| commit | 989d170dc7318ca3cbaa5b76760eb14f4e6a8605 (patch) | |
| tree | 0a486ddb4d339b8a43313f7c6e18b9595b8fd955 /library/src/math | |
| parent | 7caf98fe42797eab59a39ef71071030c9790245a (diff) | |
Fragments
Diffstat (limited to 'library/src/math')
| -rw-r--r-- | library/src/math/mod.rs | 10 | ||||
| -rw-r--r-- | library/src/math/tex.rs | 5 |
2 files changed, 9 insertions, 6 deletions
diff --git a/library/src/math/mod.rs b/library/src/math/mod.rs index 3b1d66e9..7136c8b9 100644 --- a/library/src/math/mod.rs +++ b/library/src/math/mod.rs @@ -19,7 +19,7 @@ pub struct MathNode { pub display: bool, } -#[node(Show, LayoutInline, Texify)] +#[node(Show, Layout, Inline, Texify)] impl MathNode { fn field(&self, name: &str) -> Option<Value> { match name { @@ -48,17 +48,19 @@ impl Show for MathNode { } } -impl LayoutInline for MathNode { - fn layout_inline( +impl Layout for MathNode { + fn layout( &self, world: Tracked<dyn World>, styles: StyleChain, _: &Regions, - ) -> SourceResult<Frame> { + ) -> SourceResult<Fragment> { layout_tex(world, &self.texify(), self.display, styles) } } +impl Inline for MathNode {} + impl Texify for MathNode { fn texify(&self) -> EcoString { self.children.iter().map(Texify::texify).collect() diff --git a/library/src/math/tex.rs b/library/src/math/tex.rs index a85bab18..5f332f3c 100644 --- a/library/src/math/tex.rs +++ b/library/src/math/tex.rs @@ -39,7 +39,7 @@ pub fn layout_tex( tex: &str, display: bool, styles: StyleChain, -) -> SourceResult<Frame> { +) -> SourceResult<Fragment> { // Load the font. let variant = variant(styles); let mut font = None; @@ -98,7 +98,8 @@ pub fn layout_tex( // Render into the frame. renderer.render(&layout, &mut backend); - Ok(backend.frame) + + Ok(Fragment::frame(backend.frame)) } /// A ReX rendering backend that renders into a frame. |
