summaryrefslogtreecommitdiff
path: root/crates/typst-library/src
diff options
context:
space:
mode:
authorMax <me@mkor.je>2025-03-31 09:17:49 +0000
committerGitHub <noreply@github.com>2025-03-31 09:17:49 +0000
commit4f0fbfb7e003f6ae88c1b210fdb7b38f795fc9e4 (patch)
treec1d88be2187d6ab1566177623842cdf4b39a722f /crates/typst-library/src
parenta64af130dc84c84442d59f322b705bded28201de (diff)
Add dotless parameter to `math.accent` (#5939)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'crates/typst-library/src')
-rw-r--r--crates/typst-library/src/math/accent.rs26
1 files changed, 24 insertions, 2 deletions
diff --git a/crates/typst-library/src/math/accent.rs b/crates/typst-library/src/math/accent.rs
index b162c52b..e62b6387 100644
--- a/crates/typst-library/src/math/accent.rs
+++ b/crates/typst-library/src/math/accent.rs
@@ -13,8 +13,8 @@ use crate::math::Mathy;
/// ```
#[elem(Mathy)]
pub struct AccentElem {
- /// The base to which the accent is applied.
- /// May consist of multiple letters.
+ /// The base to which the accent is applied. May consist of multiple
+ /// letters.
///
/// ```example
/// $arrow(A B C)$
@@ -51,9 +51,24 @@ pub struct AccentElem {
pub accent: Accent,
/// The size of the accent, relative to the width of the base.
+ ///
+ /// ```example
+ /// $dash(A, size: #150%)$
+ /// ```
#[resolve]
#[default(Rel::one())]
pub size: Rel<Length>,
+
+ /// Whether to remove the dot on top of lowercase i and j when adding a top
+ /// accent.
+ ///
+ /// This enables the `dtls` OpenType feature.
+ ///
+ /// ```example
+ /// $hat(dotless: #false, i)$
+ /// ```
+ #[default(true)]
+ pub dotless: bool,
}
/// An accent character.
@@ -103,11 +118,18 @@ macro_rules! accents {
/// The size of the accent, relative to the width of the base.
#[named]
size: Option<Rel<Length>>,
+ /// Whether to remove the dot on top of lowercase i and j when
+ /// adding a top accent.
+ #[named]
+ dotless: Option<bool>,
) -> Content {
let mut accent = AccentElem::new(base, Accent::new($primary));
if let Some(size) = size {
accent = accent.with_size(size);
}
+ if let Some(dotless) = dotless {
+ accent = accent.with_dotless(dotless);
+ }
accent.pack()
}
)+