Paint math atoms in the route-D display list

This commit is contained in:
gloamxun committed 2026-10-20 13:46:54 +08:00
1 parent 38bacdfbd5
commit 946f8b1b76
4 files changed
+338 -8

No files matched your search

+4 -4
View File
@@ -6,7 +6,7 @@
use crate::cmr10::Cmr10Metrics;
#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
pub enum MathAtom {
Symbol(char),
Row(Vec<MathAtom>),
@@ -115,7 +115,7 @@ pub struct MathBox {
}
/// TeX math atom classes used for inter-atom spacing.
#[derive(Clone, Copy, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
pub enum MathClass {
Ordinary,
Binary,
@@ -822,8 +822,8 @@ fn parse_atom(chars: &[char], index: usize) -> (MathAtom, usize) {
let delimiter = chars.get(next).copied().unwrap_or('|');
(MathAtom::Symbol(delimiter), next + 1)
}
"max" | "min" | "lim" | "log" | "ln" | "sin" | "cos" | "tan" | "cot" | "sec"
| "csc" | "exp" | "det" | "dim" | "ker" | "hom" | "arg" | "deg" | "gcd" => {
"max" | "min" | "log" | "ln" | "sin" | "cos" | "tan" | "cot" | "sec" | "csc"
| "exp" | "det" | "dim" | "ker" | "hom" | "arg" | "deg" | "gcd" => {
(MathAtom::Text(command.clone()), next)
}
"mathcal" | "mathbb" | "mathbf" | "mathit" | "mathsf" | "mathtt" | "mathfrak"