]> mj.ucw.cz Git - paperjam.git/commitdiff
Fixed the margins command to match documentation
authorMartin Mares <mj@ucw.cz>
Fri, 1 Jun 2018 22:36:58 +0000 (00:36 +0200)
committerMartin Mares <mj@ucw.cz>
Fri, 1 Jun 2018 22:36:58 +0000 (00:36 +0200)
cmds.cc

diff --git a/cmds.cc b/cmds.cc
index 3fc12142d10333db5bc53f23be2c19983b6a3f45..f16cd991138ec45ee042331bf12bd50303e11cd1 100644 (file)
--- a/cmds.cc
+++ b/cmds.cc
@@ -920,14 +920,10 @@ public:
   margins_cmd(cmd *c) : marg(c, "size", "") { }
   page *process_page(page *p) override
     {
-      pdf_matrix xf;
-      xf.shift(-p->image_box.x_min, -p->image_box.y_min);
-      xf.shift(marg.l, marg.b);
-      page *q = new xform_page(p, xf);
-      q->width = p->image_box.width() + marg.l + marg.r;
-      q->height = p->image_box.height() + marg.t + marg.b;
-      if (q->width < 0.001 || q->height < 0.001)
-       err("Margins must result in positive page dimensions");
+      page *q = new xform_page(p, pdf_matrix());
+      q->image_box = BBox(marg.l, marg.t, p->width - marg.r, p->height - marg.b);
+      if (q->image_box.width() < 0.001 || q->image_box.height() < 0.001)
+       err("Margins must result in positive image dimensions");
       return q;
     }
 };