Paint insertion material in route-D display lists
This commit is contained in:
1 parent
8b33051355
commit
159bb6a386
3 files changed
+35
-1
No files matched your search
@@ -1347,6 +1347,30 @@ mod tests {
|
||||
let pdf = crate::pdf::display_list_to_pdf(&list, 792 * 65_536);
|
||||
assert!(String::from_utf8_lossy(&pdf).contains("0.5 g 10 10 20 20 re f"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn insertion_contents_reach_the_display_list() {
|
||||
let page = Page {
|
||||
items: vec![VerticalItem::Insertion(Insertion {
|
||||
class: 0,
|
||||
height: 20 * 65_536,
|
||||
items: vec![VerticalItem::Rule {
|
||||
width: 100 * 65_536,
|
||||
height: 2 * 65_536,
|
||||
}],
|
||||
})],
|
||||
insertions: Vec::new(),
|
||||
marks: Vec::new(),
|
||||
floats: Vec::new(),
|
||||
sources: Vec::new(),
|
||||
hash: 0,
|
||||
};
|
||||
let list = page.display_list();
|
||||
assert!(list.items.iter().any(|item| matches!(
|
||||
item,
|
||||
crate::render::DisplayItem::Rule { width, .. } if *width == 100 * 65_536
|
||||
)));
|
||||
}
|
||||
#[test]
|
||||
fn link_rectangles_become_pdf_annotations() {
|
||||
use crate::render::DisplayList;
|
||||
|
||||
@@ -232,7 +232,15 @@ impl Page {
|
||||
pub fn display_list(&self) -> DisplayList {
|
||||
let mut list = DisplayList::default();
|
||||
let mut y = 0_i64;
|
||||
for item in &self.items {
|
||||
let items: Vec<VerticalItem> = self
|
||||
.items
|
||||
.iter()
|
||||
.flat_map(|item| match item {
|
||||
VerticalItem::Insertion(insertion) => insertion.items.clone(),
|
||||
_ => vec![item.clone()],
|
||||
})
|
||||
.collect();
|
||||
for item in &items {
|
||||
match item {
|
||||
VerticalItem::Box(box_) => {
|
||||
y += box_.height;
|
||||
|
||||
@@ -257,3 +257,5 @@ PDF writer: `src/pdf.rs` emits a one-page PDF 1.4 for a `DisplayList` (Base-14 T
|
||||
M6 (partial): display-list Link rectangles become PDF /Annots /Subtype /Link /URI dictionaries. Raw-RGB images are PDF XObjects; /special and embedded font subsets remain.
|
||||
|
||||
M7 (partial): DisplayList::special injects raw PDF content-stream operators; SVG previews show a comment. Driver-level \special parsing and coordinate transforms remain.
|
||||
|
||||
M2 (partial): insertion material is expanded into the page display list at its reserved position, so footnote/float material is no longer dropped by the painter; page-bottom placement and rules remain to be modelled.
|
||||
Reference in new issue
Block a user