diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-04-07 10:50:39 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-04-07 11:07:00 +0200 |
| commit | 3d52387eea321e94c13b61666f7a758052b20c5d (patch) | |
| tree | 5c55c51ca7e4b53dee61d280c39b7f664b8b9d6b /src/library/math | |
| parent | 20b4d590b3efbd9b7a44fd6d3a658e7b84d21b99 (diff) | |
Rework style chains
Diffstat (limited to 'src/library/math')
| -rw-r--r-- | src/library/math/mod.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/library/math/mod.rs b/src/library/math/mod.rs index ddd80435..e6548438 100644 --- a/src/library/math/mod.rs +++ b/src/library/math/mod.rs @@ -15,6 +15,7 @@ pub struct MathNode { #[node(showable)] impl MathNode { /// The raw text's font family. Just the normal text family if `auto`. + #[property(referenced)] pub const FAMILY: Smart<FontFamily> = Smart::Custom(FontFamily::new("Latin Modern Math")); @@ -28,16 +29,14 @@ impl MathNode { impl Show for MathNode { fn show(&self, ctx: &mut Context, styles: StyleChain) -> TypResult<Content> { + let args = [Value::Str(self.formula.clone()), Value::Bool(self.display)]; let mut content = styles - .show(self, ctx, [ - Value::Str(self.formula.clone()), - Value::Bool(self.display), - ])? + .show::<Self, _>(ctx, args)? .unwrap_or_else(|| Content::Text(self.formula.trim().into())); let mut map = StyleMap::new(); - if let Smart::Custom(family) = styles.get_cloned(Self::FAMILY) { - map.set_family(family, styles); + if let Smart::Custom(family) = styles.get(Self::FAMILY) { + map.set_family(family.clone(), styles); } content = content.styled_with_map(map); |
