Carry XDV device advances through packed box scopes
This commit is contained in:
1 parent
9da75c82f5
commit
9efededf6d
14 files changed
+252
-83
No files matched your search
+8
-7
@@ -775,7 +775,8 @@ impl Files {
|
||||
let mut images = Vec::new();
|
||||
let mut graphics = Vec::new();
|
||||
let mut paint_order = Vec::new();
|
||||
for item in &page.items {
|
||||
for (index, item) in page.items.iter().enumerate() {
|
||||
let shift = page.xdv_horizontal_offset(index);
|
||||
match item {
|
||||
DisplayItem::NativeGlyph {
|
||||
x,
|
||||
@@ -787,13 +788,13 @@ impl Files {
|
||||
} => {
|
||||
paint_order.push(json!(["glyph", glyphs.len()]));
|
||||
glyphs.push(
|
||||
json!({"x": x, "y": y, "size": size, "slot": slot, "font": font.name}),
|
||||
json!({"x": x - shift, "y": y, "size": size, "slot": slot, "font": font.name}),
|
||||
);
|
||||
}
|
||||
DisplayItem::OpenTypeGlyph { x, y, size, glyph, text, font, .. } => {
|
||||
paint_order.push(json!(["glyph", glyphs.len()]));
|
||||
glyphs.push(json!({
|
||||
"x": x, "y": y, "size": size, "glyph": glyph,
|
||||
"x": x - shift, "y": y, "size": size, "glyph": glyph,
|
||||
"font": font.name, "text": text, "resource": font.resource.version,
|
||||
}));
|
||||
}
|
||||
@@ -804,11 +805,11 @@ impl Files {
|
||||
height,
|
||||
} => {
|
||||
paint_order.push(json!(["rule", rules.len()]));
|
||||
rules.push(json!({"x": x, "y": y, "width": width, "height": height}));
|
||||
rules.push(json!({"x": x - shift, "y": y, "width": width, "height": height}));
|
||||
}
|
||||
DisplayItem::PdfForm { x, y, form } => {
|
||||
paint_order.push(json!(["pdf_form", images.len()]));
|
||||
images.push(json!({"x": x, "y": y, "width": form.width,
|
||||
images.push(json!({"x": x - shift, "y": y, "width": form.width,
|
||||
"height": form.height, "depth": form.depth, "id": form.number}));
|
||||
}
|
||||
DisplayItem::PdfImage {
|
||||
@@ -820,7 +821,7 @@ impl Files {
|
||||
} => {
|
||||
paint_order.push(json!(["pdf_image", images.len()]));
|
||||
images.push(json!({
|
||||
"x":x, "y":y, "width":width, "height":height,
|
||||
"x": x - shift, "y":y, "width":width, "height":height,
|
||||
"id":image.id, "page":image.image.page, "resource":image.image.version,
|
||||
}));
|
||||
}
|
||||
@@ -828,7 +829,7 @@ impl Files {
|
||||
| DisplayItem::OpenTypeActualText(_) | DisplayItem::OpenTypeColor(_) => {}
|
||||
DisplayItem::PdfGraphics { x, y, operation } => {
|
||||
paint_order.push(json!(["pdf_graphics", graphics.len()]));
|
||||
graphics.push(json!({"x": x, "y": y, "operation": operation}));
|
||||
graphics.push(json!({"x": x - shift, "y": y, "operation": operation}));
|
||||
}
|
||||
_ => {
|
||||
return Err("unsupported material in native shipout layout manifest".into());
|
||||
|
||||
Reference in new issue
Block a user