From 155af2318e4e747770965f7d0d54f3d934b37536 Mon Sep 17 00:00:00 2001
From: Leedehai <18319900+Leedehai@users.noreply.github.com>
Date: Wed, 3 Jan 2024 04:37:20 -0500
Subject: [PATCH] Sync the new combining accents added in PR #2218 (#3069)
---
crates/typst/src/math/accent.rs | 6 ++++--
crates/typst/src/symbols/symbol.rs | 5 +++--
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/crates/typst/src/math/accent.rs b/crates/typst/src/math/accent.rs
index 9ebbfc34..06fd6bab 100644
--- a/crates/typst/src/math/accent.rs
+++ b/crates/typst/src/math/accent.rs
@@ -45,15 +45,17 @@ pub struct AccentElem {
/// | Macron | `macron` | `¯` |
/// | Breve | `breve` | `˘` |
/// | Dot | `dot` | `.` |
- /// | Double dot | `dot.double` | `¨` |
+ /// | Double dot, Diaeresis | `dot.double`, `diaer` | `¨` |
/// | Triple dot | `dot.triple` | ⃛ |
/// | Quadruple dot | `dot.quad` | ⃜ |
- /// | Diaeresis | `diaer` | `¨` |
/// | Circle | `circle` | `∘` |
/// | Double acute | `acute.double` | `˝` |
/// | Caron | `caron` | `ˇ` |
/// | Right arrow | `arrow`, `->` | `→` |
/// | Left arrow | `arrow.l`, `<-` | `←` |
+ /// | Left/Right arrow | `arrow.l.r` | `↔` |
+ /// | Right harpoon | `harpoon` | `⇀` |
+ /// | Left harpoon | `harpoon.lt` | `↼` |
#[required]
pub accent: Accent,
diff --git a/crates/typst/src/symbols/symbol.rs b/crates/typst/src/symbols/symbol.rs
index 8a7707cd..4ba60382 100644
--- a/crates/typst/src/symbols/symbol.rs
+++ b/crates/typst/src/symbols/symbol.rs
@@ -134,7 +134,8 @@ impl Symbol {
set.into_iter()
}
- /// Normalize an accent to a combining one.
+ /// Normalize an accent to a combining one. Keep it synced with the
+ /// documenting table in accent.rs AccentElem.
pub fn combining_accent(c: char) -> Option {
Some(match c {
'\u{0300}' | '`' => '\u{0300}',
@@ -153,9 +154,9 @@ impl Symbol {
'\u{030c}' | 'ˇ' => '\u{030c}',
'\u{20d6}' | '←' => '\u{20d6}',
'\u{20d7}' | '→' | '⟶' => '\u{20d7}',
+ '\u{20e1}' | '↔' | '⟷' => '\u{20e1}',
'\u{20d0}' | '↼' => '\u{20d0}',
'\u{20d1}' | '⇀' => '\u{20d1}',
- '\u{20e1}' | '↔' | '⟷' => '\u{20e1}',
_ => return None,
})
}