Embed a single monospace face to shrink PDFs

This commit is contained in:
gloamxun committed 2026-10-19 21:42:17 +08:00
1 parent 2076da8f21
commit ea14b3edbf
5 files changed
+41 -5

No files matched your search

+19
View File
@@ -109,6 +109,25 @@ fn arxiv_author_orcid_links_have_pdf_annotations() {
);
}
#[test]
fn arxiv_pdf_embeds_a_single_monospace_face() {
let path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("fixtures")
.join("arxiv-template")
.join("template.tex");
let source = std::fs::read_to_string(&path).expect("read arXiv fixture");
let file_name = path.to_string_lossy().to_string();
let pdf = CompilerSession::default()
.compile(&source, &file_name)
.expect("arXiv PDF");
let text = String::from_utf8_lossy(&pdf);
let faces = text.matches("FontFile2").count();
assert!(
faces <= 5,
"arXiv PDF should embed four serif faces plus one monospace face, got {faces}"
);
}
#[test]
fn arxiv_fixture_is_three_letter_pages() {
let path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))