Embed math symbols as Computer Modern Type1 outlines

This commit is contained in:
gloamxun committed 2026-10-24 03:42:45 +08:00
1 parent a07d93510f
commit 6446de6b6b
7 files changed
+89 -8

No files matched your search

+26
View File
@@ -4139,6 +4139,32 @@ mod tests {
)));
}
#[test]
fn math_symbol_paints_with_the_cmsy_face() {
use crate::render::{DisplayItem, FontFace};
let document = Document::new(
1_000_000,
vec![Unit::math(
1,
crate::math::parse_math("\\times"),
&Cmr10Metrics::Math,
)],
);
let engine = Engine::layout(&document);
let list = engine.pages()[0].display_list();
let symbols: Vec<(String, FontFace)> = list
.items
.iter()
.filter_map(|item| match item {
DisplayItem::Text { text, font, .. } if text == "\u{00D7}" => {
Some((text.clone(), *font))
}
_ => None,
})
.collect();
assert_eq!(symbols, vec![("\u{00D7}".to_owned(), FontFace::MathSymbol)]);
}
#[test]
fn math_alphabet_paints_with_its_type1_face() {
use crate::render::{DisplayItem, FontFace};