retire the dark pattern

main
Matthew Butterick 6 years ago
parent e34d227e3f
commit b76fa53bd4

@ -1,5 +1,14 @@
#lang at-exp racket/base
(require "racket.rkt")
(require
racket/class
racket/file
racket/match
racket/string
racket/contract
racket/list
sugar/unstable/class
sugar/unstable/js
sugar/unstable/dict)
(provide AFMFont AFMFont-open)

@ -1,5 +1,12 @@
#lang racket/base
(require "racket.rkt")
(require
"struct.rkt"
racket/class
racket/match
racket/contract
sugar/unstable/class
sugar/unstable/js
sugar/unstable/dict)
(provide annotation-mixin)

@ -1,7 +1,9 @@
#lang racket/base
(require "racket.rkt")
(require sugar/list)
(require
racket/string
racket/format
racket/function
sugar/list)
(provide binprint)
(define (binprint in #:width [width 16])
@ -30,4 +32,4 @@
(module+ test
#;(binprint (open-input-bytes #"foobar is the name"))
(binprint (open-input-file "test/test12.pdf") #:width 24))
(binprint (open-input-file "../ptest/test12.pdf") #:width 24))

@ -1,5 +1,13 @@
#lang racket/base
(require "racket.rkt")
(require
"helper.rkt"
racket/class
racket/match
racket/string
racket/contract
sugar/unstable/class
sugar/unstable/js
sugar/unstable/dict)
(provide color-mixin)

@ -1,8 +1,25 @@
#lang at-exp racket/base
(require "racket.rkt")
(require "reference.rkt" "object.rkt" "page.rkt")
(require "vector.rkt" "color.rkt" "fonts.rkt" "text.rkt" "images.rkt" "annotations.rkt")
(require
"helper.rkt"
"param.rkt"
"struct.rkt"
racket/class
racket/format
racket/contract
racket/list
sugar/unstable/class
sugar/unstable/js
sugar/unstable/dict
sugar/unstable/port
"reference.rkt"
"object.rkt"
"page.rkt"
"vector.rkt"
"color.rkt"
"fonts.rkt"
"text.rkt"
"images.rkt"
"annotations.rkt")
(provide PDFDocument)
(define mixed% (annotation-mixin (image-mixin (text-mixin (fonts-mixin (color-mixin (vector-mixin object%)))))))

@ -1,7 +1,23 @@
#lang racket/base
(require "racket.rkt")
(require "font.rkt" fontland "reference.rkt")
(require
(for-syntax racket/base)
"param.rkt"
"struct.rkt"
racket/class
racket/match
racket/string
racket/format
racket/contract
racket/list
racket/function
br/define
sugar/unstable/class
sugar/unstable/js
sugar/unstable/dict
sugar/unstable/contract
"font.rkt"
fontland
"reference.rkt")
(provide EmbeddedFont)
#|

@ -1,7 +1,11 @@
#lang racket/base
(require "racket.rkt")
(require "standard-font.rkt" "font.rkt" fontland "embedded.rkt")
(require
racket/class
racket/contract
"standard-font.rkt"
"font.rkt"
fontland
"embedded.rkt")
(provide PDFFont-open)
(define/contract (PDFFont-open document src family id)

@ -1,7 +1,10 @@
#lang racket/base
(require "racket.rkt")
(require "reference.rkt")
(require
racket/class
racket/contract
sugar/unstable/class
sugar/unstable/js
"reference.rkt")
(provide PDFFont)
(define PDFFont

@ -1,7 +1,12 @@
#lang racket/base
(require "racket.rkt")
(require "font.rkt" "font-open.rkt")
(require
racket/class
racket/match
racket/contract
sugar/unstable/class
sugar/unstable/js
sugar/unstable/dict
"font-open.rkt")
(provide fonts-mixin)
(define (fonts-mixin [% mixin-tester%])

@ -1,7 +1,10 @@
#lang racket/base
(require "racket.rkt")
(require "jpeg.rkt" "png.rkt")
(require
"helper.rkt"
racket/class
racket/contract
"jpeg.rkt"
"png.rkt")
(provide PDFImage-open)
#;(define PDFImage

@ -1,7 +1,12 @@
#lang racket/base
(require "racket.rkt")
(require "image.rkt")
(require
racket/class
racket/match
racket/contract
sugar/unstable/class
sugar/unstable/js
sugar/unstable/dict
"image.rkt")
(provide image-mixin)
(define (image-mixin [% mixin-tester%])

@ -1,5 +1,11 @@
#lang debug racket/base
(require "racket.rkt")
(require
racket/class
racket/contract
sugar/unstable/class
sugar/unstable/js
sugar/unstable/dict
sugar/unstable/port)
(provide JPEG)

@ -1,5 +1,3 @@
#lang racket/base
(require "racket.rkt")
(require "document.rkt")
(provide (all-from-out "document.rkt"))

@ -1,7 +1,12 @@
#lang racket/base
(require "racket.rkt")
(require (only-in srfi/19 date->string))
(require
"struct.rkt"
racket/class
racket/string
racket/contract
racket/list
sugar/unstable/js
(only-in srfi/19 date->string))
(provide PDFObject convert)
(define PDFObject

@ -1,5 +1,10 @@
#lang racket/base
(require racket/class rackunit "document.rkt" "page.rkt" "reference.rkt" "helper.rkt" sugar/unstable/js)
(require racket/class
rackunit
"document.rkt"
"page.rkt"
"reference.rkt"
sugar/unstable/js)
(define p (make-object PDFPage (make-object PDFDocument)))
(check-equal? (· p size) "letter")
(check-equal? (· p layout) "portrait")

@ -1,5 +1,10 @@
#lang racket/base
(require "racket.rkt")
(require
racket/class
racket/contract
sugar/unstable/class
sugar/unstable/js
sugar/unstable/dict)
(provide PDFPage)

@ -1,7 +1,10 @@
#lang racket/base
(require "racket.rkt")
(require brag/support sugar/list)
(require
racket/class
racket/match
racket/list
brag/support
sugar/list)
(provide parse-svg-path)
(define (parse-svg-path doc path)

@ -1,12 +1,36 @@
#lang racket/base
(require "racket.rkt" "check-pdf.rkt")
(provide (all-from-out "racket.rkt"))
(require
(for-syntax racket/base)
"helper.rkt"
"param.rkt"
"struct.rkt"
sugar/debug
racket/class
racket/file
racket/match
racket/string
racket/format
racket/contract
racket/list
racket/port
racket/function
br/define
sugar/unstable/class
sugar/unstable/js
sugar/unstable/dict
sugar/unstable/stub
sugar/unstable/port
sugar/unstable/contract
describe
"check-pdf.rkt")
(provide check-copy-equal? check-pdfkit? make-doc)
(test-mode #t)
(r+p rackunit racket/runtime-path pitfall/document)
(require rackunit racket/runtime-path pitfall/document racket/class)
(provide (all-from-out rackunit racket/runtime-path pitfall/document racket/class))
(define (this->control this) (path-add-extension this #"" #" copy."))

@ -1,7 +1,11 @@
#lang racket/base
(require "racket.rkt")
(require
sugar/debug
racket/file
racket/contract
racket/list
sugar/unstable/dict)
(require "zlib.rkt")
(provide read-png)
#|

@ -1,5 +1,12 @@
#lang debug racket/base
(require "racket.rkt")
(require
racket/class
racket/contract
racket/list
sugar/unstable/class
sugar/unstable/js
sugar/unstable/dict
sugar/unstable/port)
(require "png-reader.rkt" "zlib.rkt")
(provide PNG)
@ -86,7 +93,7 @@
;; embed the actual image data
(send (· this obj) end (· this imgData)))
(require sugar/debug racket/draw)
(require racket/draw)
;; todo: this function is too slow.
;; switch to draw/unsafe/png
(define/contract (splitAlphaChannel this)
@ -105,15 +112,15 @@
#;(report 'unpacking-argb)
(define-values (imgBytes alphaBytes)
(parameterize ([current-input-port (open-input-bytes pixels)])
(for/fold ([img-bytes empty]
[alpha-bytes empty]
#:result (values (apply bytes-append (reverse img-bytes))
(apply bytes-append (reverse alpha-bytes))))
([i (in-naturals)]
#:break (eof-object? (peek-byte)))
(if (even? i)
(values img-bytes (cons (read-bytes 1) alpha-bytes))
(values (cons (read-bytes 3) img-bytes) alpha-bytes)))))
(for/fold ([img-bytes empty]
[alpha-bytes empty]
#:result (values (apply bytes-append (reverse img-bytes))
(apply bytes-append (reverse alpha-bytes))))
([i (in-naturals)]
#:break (eof-object? (peek-byte)))
(if (even? i)
(values img-bytes (cons (read-bytes 1) alpha-bytes))
(values (cons (read-bytes 3) img-bytes) alpha-bytes)))))
#;(report 'deflate-imgBytes)
(set-field! imgData this (deflate imgBytes))

@ -1,34 +0,0 @@
#lang racket/base
(require (for-syntax racket/base br/syntax))
(provide (for-syntax (all-from-out racket/base br/syntax)))
(provide (all-from-out racket/base) r+p)
(define-syntax-rule (r+p id ...) (begin (require id ...) (provide (all-from-out id ...))))
(r+p "helper.rkt"
"param.rkt"
"struct.rkt"
sugar/debug
racket/class
racket/file
racket/match
racket/string
racket/format
racket/contract
racket/list
racket/port
racket/function
br/define
sugar/unstable/class
sugar/unstable/js
sugar/unstable/dict
sugar/unstable/stub
sugar/unstable/port
sugar/unstable/contract
describe)
(module reader syntax/module-reader
#:language 'pitfall/racket
#:read @-read
#:read-syntax @-read-syntax
(require (prefix-in @- scribble/reader)))

@ -1,7 +1,16 @@
#lang racket/base
(require "racket.rkt")
(require "object.rkt" "zlib.rkt")
(require
"helper.rkt"
"param.rkt"
racket/class
racket/contract
racket/list
sugar/unstable/class
sugar/unstable/js
sugar/unstable/dict
sugar/unstable/port
"object.rkt"
"zlib.rkt")
(provide PDFReference)
(define-subclass object% (PDFReference document id [payload (mhash)])

@ -1,8 +1,16 @@
#lang racket/base
(require "racket.rkt")
(require "afm-font.rkt" "font.rkt" fontland)
(require racket/runtime-path)
(require
(for-syntax racket/base)
racket/class
racket/file
racket/contract
sugar/unstable/class
sugar/unstable/js
sugar/unstable/dict
"afm-font.rkt"
"font.rkt"
fontland
racket/runtime-path)
(provide isStandardFont standard-fonts StandardFont)
(define-subclass PDFFont (StandardFont document name id)

@ -1,7 +1,16 @@
#lang racket/base
(require "racket.rkt")
(require sugar/list racket/promise)
(require
racket/class
racket/match
racket/string
racket/contract
racket/list
racket/function
sugar/unstable/class
sugar/unstable/js
sugar/unstable/dict
sugar/list
racket/promise)
(provide text-mixin)
#|

@ -1,7 +1,14 @@
#lang racket/base
(require "racket.rkt")
(require "path.rkt")
(require
"helper.rkt"
racket/class
racket/match
racket/string
racket/contract
sugar/unstable/class
sugar/unstable/js
sugar/unstable/dict
"path.rkt")
(provide vector-mixin default-ctm-value)
(define (vector-mixin [% mixin-tester%])

@ -1,5 +1,4 @@
#lang racket/base
(require "racket.rkt")
(provide deflate inflate)

Loading…
Cancel
Save