From 0135c729e7517627a2a8f63e5b0de0d214fe8efc Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Thu, 23 May 2019 09:09:21 -0700 Subject: [PATCH] next: imp hard page break --- quad/quadwriter/core.rkt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/quad/quadwriter/core.rkt b/quad/quadwriter/core.rkt index acc975e0..2b601ae3 100644 --- a/quad/quadwriter/core.rkt +++ b/quad/quadwriter/core.rkt @@ -1,6 +1,5 @@ #lang debug racket/base -(require (for-syntax) - racket/promise +(require racket/promise racket/match racket/list racket/file @@ -12,6 +11,8 @@ sugar/debug racket/unsafe/ops hyphenate + racket/contract + sugar/coerce "attrs.rkt" "param.rkt" "font.rkt") @@ -173,6 +174,9 @@ (define hrbr (make-q:hr-break #:printable #t #:id 'hrbr)) +(define-quad q:page-break quad ()) +(define pgbr (make-q:page-break #:printable #f #:id 'pgbr)) + (module+ test (require rackunit) (check-true (q:line-break? (second (quad-elems (q "foo" pbr "bar"))))) @@ -517,6 +521,7 @@ ;; `page-wrap` should emit quads that are complete. (wrap xs vertical-height #:soft-break (λ (q) #true) + #:hard-break q:page-break? #:no-break (λ (q) (quad-ref q 'no-pbr)) #:distance (λ (q dist-so-far wrap-qs) ;; do trial block insertions @@ -571,9 +576,9 @@ (match el [(== para-break) pbr] [(== line-break) lbr] + [(== page-break) pgbr] [_ el])) x)) -(require racket/contract sugar/coerce pitfall/page) (define default-page-size "letter") (define default-page-orientation "tall") (define/contract (render-pdf qx-arg pdf-path-arg