Render native XeTeX PNG, JPEG and BMP graphics
This commit is contained in:
1 parent
794c2f9b2c
commit
2bd6e19519
22 files changed
+821
-120
No files matched your search
@@ -1027,15 +1027,21 @@ fn page_content(
|
||||
// The XDV driver rounds the image translation relative
|
||||
// to its page origin, with three decimals by default.
|
||||
let round = |value: f64| (value * 1000.0).round() / 1000.0;
|
||||
let x = round(list.units.bp(*x) + tx - origin_x) + round(origin_x)
|
||||
let [left, bottom] = placement.layout_offset;
|
||||
let x = round(list.units.bp(*x - left) + tx - origin_x) + round(origin_x)
|
||||
- list.units.bp(h);
|
||||
let y = round(list.units.bp(height - *y - *image_height) + ty - origin_y)
|
||||
+ round(origin_y) - list.units.bp(v);
|
||||
let y = round(
|
||||
list.units.bp(height - *y - *image_height - bottom) + ty - origin_y,
|
||||
) + round(origin_y) - list.units.bp(v);
|
||||
let [a, b, c, d, x, y] = [a, b, c, d, x, y].map(crate::pdf_image::real);
|
||||
content.push_str(&format!(
|
||||
"q {a} {b} {c} {d} {x} {y} cm /PI{} Do Q\n",
|
||||
image.id
|
||||
));
|
||||
content.push_str(&format!("q {a} {b} {c} {d} {x} {y} cm "));
|
||||
if let Some(clip) = placement.clip() {
|
||||
let [x, y, w, h] = clip.map(|value| {
|
||||
crate::pdf_image::real((value * 1000.0).round() / 1000.0)
|
||||
});
|
||||
content.push_str(&format!("{x} {y} {w} {h} re W n "));
|
||||
}
|
||||
content.push_str(&format!("/PI{} Do Q\n", image.id));
|
||||
continue;
|
||||
}
|
||||
let [sx, sy] = if image.image.raster_frame().is_some()
|
||||
|
||||
Reference in new issue
Block a user