For me, the translation error is (at least) at CairoRenderer::setupDocument, in which the pixel size is rounded up to an integer before it is converted to points. This leads to exactly the difference I see in the point sizes of the source and target. The offending code:
For me, the translation error is (at least) at CairoRenderer: :setupDocument, in which the pixel size is rounded up to an integer before it is converted to points. This leads to exactly the difference I see in the point sizes of the source and target. The offending code:
NRRect d; document_ width(doc) ); document_ height( doc));
sp_item_ invoke_ bbox(base, &d, sp_item_ i2d_affine( base), TRUE, SPItem: :RENDERING_ BBOX);
if (pageBoundingBox) {
d.x0 = d.y0 = 0;
d.x1 = ceil(sp_
d.y1 = ceil(sp_
} else {
}
if (ctx->_ vector_ based_target) {
// convert from px to pt
d.x0 *= PT_PER_PX;
d.x1 *= PT_PER_PX;
d.y0 *= PT_PER_PX;
d.y1 *= PT_PER_PX;
}
(PT_PER_PX is 1.0/1.25)
In gdb at the end of the above lines:
(gdb) print d
$4 = {x0 = 0, y0 = 0, x1 = 842.40000000000009, y1 = 596}
Manual calculations show the desired result without rounding errors:
(gdb) print sp_document_ height( doc) width(doc)
$5 = 744.094482421875
(gdb) print sp_document_
$6 = 1052.3621826171875
(gdb) print sp_document_ width(doc) /1.25 height( doc)/1. 25
$10 = 841.88974609374998
(gdb) print sp_document_
$11 = 595.27558593749995