Embed text fonts and fix preview table rule coordinates

This commit is contained in:
gloamxun committed 2026-10-19 21:07:25 +08:00
1 parent b119c57e8e
commit 2856506d65
6 files changed
+37 -35

No files matched your search

+15 -14
View File
@@ -1070,22 +1070,18 @@ After.
}
#[test]
fn ascii_documents_use_base14_fonts_without_embedding() {
fn ascii_documents_embed_the_latin_font() {
let source = r"\documentclass{article}
\begin{document}
Plain text that only needs the standard Times encoding.
\end{document}";
let pdf = CompilerSession::default()
.compile(source, "base14.tex")
.expect("base14 PDF");
.compile(source, "embedded.tex")
.expect("embedded PDF");
let text = String::from_utf8_lossy(&pdf);
assert!(
text.contains("Times-Roman"),
"expected a Base-14 Times face"
);
assert!(
!text.contains("FontFile2"),
"ASCII text should not embed a TrueType program"
text.contains("FontFile2"),
"Latin text should embed a TrueType program so viewers do not substitute"
);
}
@@ -1113,10 +1109,15 @@ fn arxiv_table_rules_follow_a_narrow_centered_table() {
.nth(1)
.and_then(|rest| rest.split('"').next())
.and_then(|value| value.parse::<f64>().ok());
if let (Some(x1), Some(x2)) = (x1, x2) {
let y1 = tag
.split("y1=\"")
.nth(1)
.and_then(|rest| rest.split('\"').next())
.and_then(|value| value.parse::<f64>().ok());
if let (Some(x1), Some(x2), Some(y1)) = (x1, x2, y1) {
let width = x2 - x1;
if x1 > 20.0 && width > 40.0 && width < 140.0 {
table_rules.push((x1, width));
table_rules.push((x1, width, y1));
}
}
}
@@ -1127,12 +1128,12 @@ fn arxiv_table_rules_follow_a_narrow_centered_table() {
assert!(
table_rules
.iter()
.all(|(x, width)| *x > 20.0 && *width < 140.0),
"table rules should be centered and narrower than the text block: {table_rules:?}"
.all(|(x, width, y)| *x > 20.0 && *width < 140.0 && *y > 20.0),
"table rules should be centered, below the page top, and narrower than the text block: {table_rules:?}"
);
let widest = table_rules
.iter()
.map(|(_, width)| *width)
.map(|(_, width, _)| *width)
.fold(0.0_f64, f64::max);
assert!(
(60.5..62.5).contains(&widest),