From 6996eac838d8a0fb071a08c4f7cc2ac190afa6d4 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Tue, 13 Aug 2019 12:35:58 -0700 Subject: [PATCH] tiny simplify --- quad/quadwriter/render.rkt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/quad/quadwriter/render.rkt b/quad/quadwriter/render.rkt index 1133865c..f522da1d 100644 --- a/quad/quadwriter/render.rkt +++ b/quad/quadwriter/render.rkt @@ -217,8 +217,8 @@ (match-define (list page-width page-height) (parse-page-size (and (pair? qs) (car qs)))) (match-define (list left-margin top-margin right-margin bottom-margin) (setup-margins qs page-width page-height)) - (define maybe-gutter-margin (and (pair? qs) (quad-ref (car qs) :page-margin-gutter))) - (define printable-width (- page-width left-margin right-margin (or maybe-gutter-margin 0))) + (define gutter-margin (and (pair? qs) (quad-ref (car qs) :page-margin-gutter 0))) + (define printable-width (- page-width left-margin right-margin gutter-margin)) (define printable-height (- page-height top-margin bottom-margin)) (define column-count (setup-column-count qs)) (define column-gap (setup-column-gap qs)) @@ -232,10 +232,7 @@ (define page-quad-prototype (λ (page-count) - (define left-shift (+ left-margin - (cond - [(and (odd? page-count) maybe-gutter-margin)] - [else 0]))) + (define left-shift (+ left-margin (if (odd? page-count) gutter-margin 0))) (struct-copy quad q:page [shift (pt left-shift top-margin)] [size (pt line-wrap-size printable-height)])))