ElyPDF: write in a document's subset font through the page's own glyph codes (R2.17)
This commit is contained in:
3 files changed
+109
-4
No files matched your search
@@ -275,3 +275,19 @@ fn runs_on_one_baseline_still_wrap_onto_new_lines() {
|
||||
tops.dedup();
|
||||
assert!(tops.len() >= 3, "each wrapped line has its own baseline: {tops:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_subset_font_writes_with_its_own_glyphs_and_reads_back() {
|
||||
// LibreOffice's export: a subset font whose own tables are placeholders.
|
||||
let path = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../tests/fixtures/office/t.pdf");
|
||||
let mut worker = worker();
|
||||
let mut doc = worker.open(&path).expect("opens").doc;
|
||||
let at = worker.text_blocks(doc, 0).expect("blocks").iter().position(|b| b.text.contains("BUNDLE")).expect("the block");
|
||||
let mut writing = rewrite(&mut worker, doc, at, "TEXT BUNDLE", "original");
|
||||
// Room for one line, so the space is not a line break.
|
||||
writing.bx[2] *= 2.0;
|
||||
assert!(matches!(worker.put_text(doc, 0, &writing, 0.0).expect("answers"), Wrote::Done(_)), "the page's glyphs suffice");
|
||||
doc = worker.now(doc).expect("the state");
|
||||
let now = page_text(&mut worker, doc);
|
||||
assert!(now.contains("TEXT BUNDLE"), "the new words read back: {now:?}");
|
||||
}
|
||||
Reference in new issue
Block a user