From 09af0574e103d2c035ccad37239e12fba5300c08 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Thu, 2 May 2019 19:46:21 -0700 Subject: [PATCH] and more --- quad/quad/position.rkt | 5 +++-- quad/quadwriter/core.rkt | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/quad/quad/position.rkt b/quad/quad/position.rkt index b342529e..841b45bc 100644 --- a/quad/quad/position.rkt +++ b/quad/quad/position.rkt @@ -78,8 +78,9 @@ (define (position q [previous-end-pt (pt 0 0)]) ;; recursively calculates coordinates for quad & subquads ;; based on starting origin point - (define new-origin (pt- previous-end-pt (in-point q))) - (let ([q (struct-copy quad q [origin new-origin])]) + #R (quad-origin q) + (define new-origin (pt- #R previous-end-pt #R (in-point q))) + (let ([q (struct-copy quad q [origin #R new-origin])]) (let loop ([pt (inner-point q)] [acc null] [elems (quad-elems q)]) (match elems [(== empty) (struct-copy quad q [elems (reverse acc)])] diff --git a/quad/quadwriter/core.rkt b/quad/quadwriter/core.rkt index 0f3d05fe..805c29a7 100644 --- a/quad/quadwriter/core.rkt +++ b/quad/quadwriter/core.rkt @@ -377,6 +377,8 @@ (scale doc (if zoom-mode? zoom-scale 1) (if zoom-mode? zoom-scale 1))) (define (page-draw-end q doc) + (define top-margin #R (pt-y (quad-offset q))) + (define bottom-margin (- #R (pdf-height doc) #R top-margin)) (font-size doc 10) (font doc default-font-face) (fill-color doc "black") @@ -384,7 +386,7 @@ (hash-ref (quad-attrs q) 'doc-title) (date->string (current-date) #t)) (pt-x (quad-offset q)) - (- (pdf-height doc) 80))) + (+ (- (pdf-height doc) bottom-margin) 20))) (define q:page (q #:offset '(0 0) #:draw-start page-draw-start @@ -590,8 +592,8 @@ [bottom-margin (quad-ref (car qx) 'page-margin-bottom (λ () (quad-ref (car qx) 'page-margin-top default-y-margin)))] [page-wrap-size (- (pdf-height pdf) top-margin bottom-margin)] [page-quad (struct-copy quad q:page - [offset (pt left-margin top-margin)] - [size (pt (pdf-width pdf) (pdf-height pdf))])] + [origin (pt 120 60)] + [size (pt line-wrap-size page-wrap-size)])] [qx (time-name page-wrap (page-wrap qx page-wrap-size page-quad))] [qx (time-name position (position (struct-copy quad q:doc [elems qx])))]) (time-name draw (draw qx pdf))