Render Greek math commands as their letters
\alpha through \omega, the uppercase Greek commands and the varepsilon / vartheta / varrho / varsigma / varphi / varpi / varkappa variants were not in the math command table, so a formula such as $\alpha+\beta$ painted "?" glyphs. Map them to their Unicode code points. The math renderer already treats the Greek ranges as math letters and sends them through the math-italic fallback, so the formula now previews as α+β=γ with no warnings; the widths still use the TFM fallback constant rather than per-letter cmmi metrics. A core test pins the parsed symbols and a route-D test checks the previewed characters.
This commit is contained in:
1 parent
5a1a04d029
commit
4b28d65006
4 files changed
+81
-5
No files matched your search
@@ -14464,6 +14464,24 @@ A definition.
|
||||
assert_eq!(document.widow_penalty, 88);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn math_greek_letters_render() {
|
||||
let source = "\\documentclass{article}\\begin{document}\n\n$\\alpha + \\beta = \\gamma$\n\n\\end{document}\n";
|
||||
let json = preview_json(source).expect("preview");
|
||||
let value: serde_json::Value = serde_json::from_str(&json).expect("JSON");
|
||||
let svg = value["pages"][0]["svg"].as_str().expect("svg");
|
||||
let text: String = svg
|
||||
.split('>')
|
||||
.filter_map(|piece| piece.split('<').next())
|
||||
.collect::<String>()
|
||||
.split_whitespace()
|
||||
.collect();
|
||||
assert!(text.contains('α'), "{text}");
|
||||
assert!(text.contains('β'), "{text}");
|
||||
assert!(text.contains('γ'), "{text}");
|
||||
assert!(!text.contains('?'), "{text}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn savebox_dimensions_are_frozen_and_readable() {
|
||||
let source = "\\newsavebox{\\b}\n\\sbox{\\b}{abc}\n\nX\\hspace{\\wd\\b}Y";
|
||||
|
||||
Reference in new issue
Block a user