Map math alphabets onto Computer Modern Type1 faces

This commit is contained in:
gloamxun committed 2026-10-24 03:38:53 +08:00
1 parent a95cf8092e
commit a07d93510f
5 files changed
+142 -4

No files matched your search

+24
View File
@@ -4139,6 +4139,30 @@ mod tests {
)));
}
#[test]
fn math_alphabet_paints_with_its_type1_face() {
use crate::render::{DisplayItem, FontFace};
let document = Document::new(
1_000_000,
vec![Unit::math(
1,
crate::math::parse_math("\\mathbf{x}"),
&Cmr10Metrics::Math,
)],
);
let engine = Engine::layout(&document);
let list = engine.pages()[0].display_list();
let faces: Vec<FontFace> = list
.items
.iter()
.filter_map(|item| match item {
DisplayItem::Text { text, font, .. } if text == "x" => Some(*font),
_ => None,
})
.collect();
assert_eq!(faces, vec![FontFace::Bold]);
}
#[test]
fn edit_on_second_page_only_rebuilds_second_page() {
let mut document = document();