Cover Greek text through the Liberation fallback
This commit is contained in:
1 parent
067917eae5
commit
7e006cea86
5 files changed
+55
-4
No files matched your search
@@ -564,6 +564,49 @@ fn accented_text_round_trips_through_pdf_extraction() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn greek_text_round_trips_through_pdf_fallback() {
|
||||
use std::process::Command;
|
||||
|
||||
if Command::new("pdftotext")
|
||||
.arg("-v")
|
||||
.stdout(std::process::Stdio::null())
|
||||
.stderr(std::process::Stdio::null())
|
||||
.status()
|
||||
.is_err()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
let body = "\u{3b1}\u{3b2}\u{3b3} \u{3bc}\u{3ad}\u{3b3}\u{3b1}";
|
||||
let document = Document::new(65, vec![Unit::paragraph_with_style(1, body, body_style())]);
|
||||
let engine = Engine::layout(&document);
|
||||
let lists: Vec<_> = engine
|
||||
.pages()
|
||||
.iter()
|
||||
.map(|page| page.display_list())
|
||||
.collect();
|
||||
let pdf = display_lists_to_pdf_with_cm_type1(
|
||||
&lists,
|
||||
612 * 65_536,
|
||||
792 * 65_536,
|
||||
PageOrigin::default(),
|
||||
);
|
||||
let path = std::env::temp_dir().join(format!("texrra-greek-{}.pdf", std::process::id()));
|
||||
std::fs::write(&path, &pdf).expect("write PDF");
|
||||
let output = Command::new("pdftotext")
|
||||
.arg(&path)
|
||||
.arg("-")
|
||||
.output()
|
||||
.expect("pdftotext");
|
||||
let _ = std::fs::remove_file(&path);
|
||||
let text = String::from_utf8_lossy(&output.stdout)
|
||||
.split_whitespace()
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ");
|
||||
assert!(text.contains(body), "got {text:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn computer_modern_outlines_keep_extracted_text() {
|
||||
use std::process::Command;
|
||||
|
||||
Reference in new issue
Block a user