You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
typesetting/pitfall/ptest/test10.rkt

28 lines
1.0 KiB
Racket

8 years ago
#lang pitfall/pdftest
8 years ago
(define-runtime-path tiger "assets/tiger.json")
8 years ago
(define (proc doc)
(send doc translate 220 300)
8 years ago
(for* ([datum (in-list (read (open-input-string (string-replace (file->string tiger) #rx"[,:]" " "))))]
8 years ago
[part (in-value (apply hash datum))])
(send doc path (hash-ref part 'path))
(when (hash-has-key? part "stroke-width")
(send doc lineWidth (string->number (hash-ref part "stroke-width"))))
(if (and (not (string=? (hash-ref part 'fill "none") "none"))
(not (string=? (hash-ref part 'stroke "none") "none")))
(send doc fillAndStroke (hash-ref part 'fill) (hash-ref part 'stroke))
(begin
(unless (string=? (hash-ref part 'fill "none") "none")
(send doc fill (hash-ref part 'fill)))
(unless (string=? (hash-ref part 'stroke "none") "none")
(send doc fill (hash-ref part 'stroke)))))))
(define-runtime-path this "test10rkt.pdf")
(make-doc this #f proc #:pdfkit #f)
(define-runtime-path that "test10crkt.pdf")
(make-doc that #t proc #:pdfkit #f)