Distinguish slanted from italic and add italic typewriter

Add cmsl10/cmbxsl10/cmitt10 faces so \slshape and \textsl no longer reuse the italic cmti10 and \ttfamily\itshape reaches cmitt10. The NFSS state tracks italic, slanted and small caps separately, with last-shape-wins semantics for \em and the shape commands.
This commit is contained in:
gloamxun committed 2026-10-24 12:58:41 +08:00
1 parent 6df38ced25
commit aa4d86d735
15 files changed
+328 -34

No files matched your search

+23
View File
@@ -6283,6 +6283,29 @@ mod tests {
assert!(svg.contains("font-family=\"serif\""));
}
#[test]
fn slanted_paragraph_paints_with_the_slanted_face() {
let unit = Unit::paragraph_with_face(1, "slanted text", ParagraphFont::Slanted);
let page = Page {
items: unit.items,
insertions: Vec::new(),
marks: Vec::new(),
floats: Vec::new(),
sources: Vec::new(),
hash: 0,
};
let list = page.display_list();
assert!(list.items.iter().any(|item| matches!(
item,
crate::render::DisplayItem::Text {
font: crate::render::FontFace::Slanted,
..
}
)));
let svg = list.to_svg();
assert!(svg.contains("font-style=\"italic\""));
}
#[test]
fn mono_paragraph_paints_with_a_mono_face() {
let unit = Unit::paragraph_with_face(1, "code 123", ParagraphFont::Mono);