summaryrefslogtreecommitdiff
path: root/crates/typst-library/src/math
diff options
context:
space:
mode:
authorIan Wrzesinski <wrzian@umich.edu>2024-07-29 00:25:03 -0500
committerIan Wrzesinski <wrzian@umich.edu>2025-01-23 16:28:29 -0500
commitc47b71b4350434a73734789ebde1374b791dc88e (patch)
tree0157e3dc277010bb9581eac8a5881109aedc269f /crates/typst-library/src/math
parent0b8b7d0f233f748a5c12d1b8e31f657803122eba (diff)
Basic SymbolElem addition
Diffstat (limited to 'crates/typst-library/src/math')
-rw-r--r--crates/typst-library/src/math/accent.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/typst-library/src/math/accent.rs b/crates/typst-library/src/math/accent.rs
index b87e527f..b162c52b 100644
--- a/crates/typst-library/src/math/accent.rs
+++ b/crates/typst-library/src/math/accent.rs
@@ -1,8 +1,7 @@
use crate::diag::bail;
-use crate::foundations::{cast, elem, func, Content, NativeElement, Value};
+use crate::foundations::{cast, elem, func, Content, NativeElement, SymbolElem};
use crate::layout::{Length, Rel};
use crate::math::Mathy;
-use crate::text::TextElem;
/// Attaches an accent to a base.
///
@@ -142,8 +141,8 @@ cast! {
Accent,
self => self.0.into_value(),
v: char => Self::new(v),
- v: Content => match v.to_packed::<TextElem>() {
- Some(elem) => Value::Str(elem.text.clone().into()).cast()?,
- None => bail!("expected text"),
+ v: Content => match v.to_packed::<SymbolElem>() {
+ Some(elem) => Self::new(elem.text),
+ None => bail!("expected a symbol"),
},
}