Add 10/11/12pt base font size options

This commit is contained in:
gloamxun committed 2026-10-19 13:52:24 +08:00
1 parent 269433abdb
commit 477e2124c8
8 files changed
+180 -69

No files matched your search

+29
View File
@@ -759,3 +759,32 @@ fn letter_paper_updates_text_width_length() {
"letter textwidth is wrong: {width}"
);
}
#[test]
fn document_class_font_size_scales_body_and_headings() {
for (option, body_size, heading_size) in [
("10pt", "3.5278", "4.9389"),
("11pt", "3.8806", "4.9389"),
("12pt", "4.2333", "5.9972"),
] {
let source = format!(
r"\documentclass[{option}]{{article}}
\begin{{document}}
\section{{Heading}}
Body text.
\end{{document}}
"
);
let value = fresh_preview(&source, "fontsize.tex");
assert_eq!(value["status"], "ok", "{option}: {}", value["message"]);
let svg = page_svg(&value, 0);
assert!(
svg.contains(&format!("font-size=\"{body_size}\" font-weight=\"400\"")),
"{option}: body size {body_size} missing"
);
assert!(
svg.contains(&format!("font-size=\"{heading_size}\" font-weight=\"700\"")),
"{option}: heading size {heading_size} missing"
);
}
}