From eabbbf7eae04a4a8044d83acde84d8634f095b50 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sun, 22 Jan 2023 13:16:03 +0100 Subject: Name handling for New Computer Modern Math --- library/src/math/mod.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'library/src/math/mod.rs') diff --git a/library/src/math/mod.rs b/library/src/math/mod.rs index ce70f1de..785e027a 100644 --- a/library/src/math/mod.rs +++ b/library/src/math/mod.rs @@ -102,24 +102,24 @@ impl MathNode { } impl Show for MathNode { - fn show(&self, _: &mut Vt, _: &Content, styles: StyleChain) -> SourceResult { - let mut map = StyleMap::new(); - map.set_family(FontFamily::new("NewComputerModernMath"), styles); - - let mut realized = self - .clone() - .pack() - .guarded(Guard::Base(NodeId::of::())) - .styled_with_map(map); - + fn show(&self, _: &mut Vt, _: &Content, _: StyleChain) -> SourceResult { + let mut realized = self.clone().pack().guarded(Guard::Base(NodeId::of::())); if self.block { realized = realized.aligned(Axes::with_x(Some(Align::Center.into()))) } - Ok(realized) } } +impl Finalize for MathNode { + fn finalize(&self, realized: Content) -> Content { + realized.styled( + TextNode::FAMILY, + FallbackList(vec![FontFamily::new("New Computer Modern Math")]), + ) + } +} + impl Layout for MathNode { fn layout( &self, -- cgit v1.2.3