|
|
|
@ -96,8 +96,16 @@
|
|
|
|
|
(hash-set! attrs k (parse-dimension (hash-ref attrs k))))
|
|
|
|
|
attrs)
|
|
|
|
|
|
|
|
|
|
(define (complete-every-path! attrs)
|
|
|
|
|
;; relies on `current-directory` being parameterized to source file's dir
|
|
|
|
|
(for ([(k v) (in-hash attrs)]
|
|
|
|
|
#:when (takes-path? k))
|
|
|
|
|
(hash-set! attrs k (path->string (path->complete-path v))))
|
|
|
|
|
attrs)
|
|
|
|
|
|
|
|
|
|
(define (handle-cascading-attrs attrs)
|
|
|
|
|
(parse-dimension-strings! attrs)
|
|
|
|
|
(complete-every-path! attrs)
|
|
|
|
|
(resolve-font-path! attrs)
|
|
|
|
|
(resolve-font-size! attrs)
|
|
|
|
|
(parse-font-features! attrs))
|
|
|
|
@ -161,12 +169,19 @@
|
|
|
|
|
(define (setup-column-gap qs)
|
|
|
|
|
(or (debug-column-gap) (quad-ref (car qs) :column-gap default-column-gap)))
|
|
|
|
|
|
|
|
|
|
(define/contract (render-pdf qx-arg pdf-path-arg
|
|
|
|
|
(define/contract (render-pdf qx-arg pdf-path-arg [base-dir-arg #f]
|
|
|
|
|
#:replace [replace-existing-file? #t]
|
|
|
|
|
#:compress [compress? #t])
|
|
|
|
|
((qexpr? (or/c #false path? path-string?)) (#:replace any/c
|
|
|
|
|
((qexpr? (or/c #false path? path-string?))
|
|
|
|
|
((or/c #false path? path-string?)
|
|
|
|
|
#:replace any/c
|
|
|
|
|
#:compress any/c) . ->* . (or/c void? bytes?))
|
|
|
|
|
|
|
|
|
|
(define base-dir (match base-dir-arg
|
|
|
|
|
[#false (current-directory)]
|
|
|
|
|
[path (define-values (dir name _) (split-path path))
|
|
|
|
|
dir]))
|
|
|
|
|
|
|
|
|
|
(define pdf-path (setup-pdf-path pdf-path-arg))
|
|
|
|
|
(unless replace-existing-file?
|
|
|
|
|
(when (file-exists? pdf-path)
|
|
|
|
@ -176,6 +191,9 @@
|
|
|
|
|
#:auto-first-page #false
|
|
|
|
|
#:output-path pdf-path))
|
|
|
|
|
(parameterize ([current-pdf the-pdf]
|
|
|
|
|
;; set `current-directory` so that ops like `path->complete-path`
|
|
|
|
|
;; will be handled relative to the original directory
|
|
|
|
|
[current-directory base-dir]
|
|
|
|
|
[verbose-quad-printing? #false])
|
|
|
|
|
(define qs (time-log setup-qs (setup-qs qx-arg pdf-path)))
|
|
|
|
|
(define sections
|
|
|
|
|