|
|
|
@ -472,8 +472,26 @@
|
|
|
|
|
(make-nobreak! ln)]))
|
|
|
|
|
(cons ln reversed-lines)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define default-page-size "letter")
|
|
|
|
|
(define default-page-orientation "tall")
|
|
|
|
|
(define (parse-page-size q)
|
|
|
|
|
;; page size can be specified by name, or measurements.
|
|
|
|
|
;; explicit measurements from page-height and page-width supersede those from page-size.
|
|
|
|
|
(match-define (list page-width page-height)
|
|
|
|
|
(for/list ([k (list :page-width :page-height)])
|
|
|
|
|
(and (quad? q) (match (quad-ref q k)
|
|
|
|
|
[#false #false]
|
|
|
|
|
[val (inexact->exact (floor val))]))))
|
|
|
|
|
(resolve-page-size
|
|
|
|
|
(or (debug-page-width) page-width)
|
|
|
|
|
(or (debug-page-height) page-height)
|
|
|
|
|
(quad-ref q :page-size default-page-size)
|
|
|
|
|
(quad-ref q :page-orientation default-page-orientation)))
|
|
|
|
|
|
|
|
|
|
(define (page-draw-start q doc)
|
|
|
|
|
(add-page doc)
|
|
|
|
|
(match-define (list page-width page-height) (parse-page-size q))
|
|
|
|
|
(add-page doc page-width page-height)
|
|
|
|
|
(scale doc (zoom-factor) (zoom-factor))
|
|
|
|
|
(draw-debug q doc "aliceblue" "aliceblue" 3))
|
|
|
|
|
|
|
|
|
@ -643,7 +661,10 @@
|
|
|
|
|
(match (quad-ref (car cols) :footer-display #true)
|
|
|
|
|
[(or #false "none") (from-parent cols 'nw)]
|
|
|
|
|
[_ (cons (make-footer-quad (car cols) page-idx path) (from-parent cols 'nw))]))
|
|
|
|
|
(list (quad-copy page-quad [elems elems])))
|
|
|
|
|
(list (quad-copy page-quad
|
|
|
|
|
[elems elems]
|
|
|
|
|
[attrs (copy-block-attrs (quad-attrs (car cols))
|
|
|
|
|
(hash-copy (quad-attrs page-quad)))])))
|
|
|
|
|
|
|
|
|
|
(define (page-wrap qs width [page-quad q:page])
|
|
|
|
|
(unless (positive? width)
|
|
|
|
@ -658,7 +679,7 @@
|
|
|
|
|
#:finish-wrap (page-finish-wrap page-quad (pdf-output-path (current-pdf)))))
|
|
|
|
|
|
|
|
|
|
(define (section-wrap qs)
|
|
|
|
|
qs)
|
|
|
|
|
(list qs))
|
|
|
|
|
|
|
|
|
|
(define (insert-blocks lines)
|
|
|
|
|
(define groups-of-lines (contiguous-group-by (λ (x) (quad-ref x :display)) lines))
|
|
|
|
|