From 1de53730bce0bd3f9de89db1da7c19b7889b9a75 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 27 Jan 2023 12:04:23 +0100 Subject: Symbol values and modules --- library/src/math/mod.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'library/src/math/mod.rs') diff --git a/library/src/math/mod.rs b/library/src/math/mod.rs index cbe636b1..1e7a6580 100644 --- a/library/src/math/mod.rs +++ b/library/src/math/mod.rs @@ -17,6 +17,7 @@ mod script; mod spacing; mod stretch; mod style; +mod symbols; pub use self::accent::*; pub use self::align::*; @@ -46,10 +47,10 @@ use crate::prelude::*; use crate::text::LinebreakNode; use crate::text::TextNode; use crate::text::TextSize; -use crate::text::{families, variant, FallbackList, FontFamily, SpaceNode, SymbolNode}; +use crate::text::{families, variant, FallbackList, FontFamily, SpaceNode}; /// Create a module with all math definitions. -pub fn module() -> Module { +pub fn module(sym: &Module) -> Module { let mut math = Scope::deduplicating(); math.def_func::("formula"); math.def_func::("lr"); @@ -77,7 +78,9 @@ pub fn module() -> Module { math.def_func::("mono"); math.def_func::("bb"); spacing::define(&mut math); + symbols::define(&mut math); op::define(&mut math); + math.copy_from(sym.scope()); Module::new("math").with_scope(math) } @@ -227,14 +230,6 @@ impl LayoutMath for Content { return Ok(()); } - if let Some(node) = self.to::() { - if let Some(c) = symmie::get(&node.0) { - return AtomNode(c.into()).layout_math(ctx); - } else if let Some(span) = self.span() { - bail!(span, "unknown symbol"); - } - } - if let Some(node) = self.to::() { for child in &node.0 { child.layout_math(ctx)?; -- cgit v1.2.3