Embed only the font faces used by a route-D PDF
This commit is contained in:
1 parent
472f778e75
commit
295093ae5a
3 files changed
+29
-5
No files matched your search
@@ -1957,6 +1957,18 @@ mod tests {
|
||||
assert!(text.trim_end().ends_with("%%EOF"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pdf_embeds_only_the_used_faces() {
|
||||
let document = Document::new(400, vec![Unit::paragraph(1, "roman only")]);
|
||||
let engine = Engine::layout(&document);
|
||||
let list = engine.pages()[0].display_list();
|
||||
let pdf = crate::pdf::display_list_to_pdf(&list, 400 * 65_536);
|
||||
let text = String::from_utf8_lossy(&pdf);
|
||||
assert_eq!(text.matches("/Subtype /Type0").count(), 1);
|
||||
assert!(!text.contains("/BaseFont /LiberationSerif-Bold"));
|
||||
assert!(!text.contains("/BaseFont /LiberationMono"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sans_paragraph_paints_with_the_sans_face() {
|
||||
let unit = Unit::paragraph_with_face(1, "sans face", ParagraphFont::Sans);
|
||||
|
||||
Reference in new issue
Block a user