diff --git a/pitfall/fontkit/directory.rkt b/pitfall/fontkit/directory.rkt index e7af5964..ef7f6985 100644 --- a/pitfall/fontkit/directory.rkt +++ b/pitfall/fontkit/directory.rkt @@ -14,19 +14,6 @@ https://github.com/mbutterick/fontkit/blob/master/src/tables/directory.js 'offset uint32be 'length uint32be))) -(define (pad-to-32bit bstr) - (define op (open-output-bytes)) - (write-bytes bstr op) - (file-position op (* (ceiling (/ (file-position op) 4)) 4)) - (get-output-bytes op)) - -(test-module - (check-equal? (pad-to-32bit #"") #"") - (check-equal? (pad-to-32bit #"1") #"1\0\0\0") - (check-equal? (pad-to-32bit #"12") #"12\0\0") - (check-equal? (pad-to-32bit #"123") #"123\0") - (check-equal? (pad-to-32bit #"1234") #"1234")) - ;; for stupid tags like 'cvt ' (define (symbol-replace sym this that) (string->symbol (string-replace (if (string? sym) sym (symbol->string sym)) this that))) @@ -45,8 +32,8 @@ https://github.com/mbutterick/fontkit/blob/master/src/tables/directory.js (define table-header-size (+ preamble-length (* (length (hash-keys (· this-val tables))) (send TableEntry size)))) - (define-values (table-headers table-datas) - (for/lists (ths tds) + (define-values (table-headers table-datas _) + (for/lists (ths tds lens) ([(tag table) (in-hash (· this-val tables))]) (define table-data @@ -57,11 +44,10 @@ https://github.com/mbutterick/fontkit/blob/master/src/tables/directory.js (define table-header (mhash 'tag (unescape-tag tag) 'checkSum 0 - 'offset (apply + (cons table-header-size (map bytes-length tds))) + 'offset (apply + (cons table-header-size lens)) 'length (bytes-length table-data))) - - (define table-data-padded (pad-to-32bit table-data)) - (values table-header table-data-padded))) + + (values table-header table-data (bytes-length table-data)))) (define numTables (length table-headers)) diff --git a/pitfall/pitfall/test/test12.pdf b/pitfall/pitfall/test/test12.pdf index d84fe023..b9eace51 100644 Binary files a/pitfall/pitfall/test/test12.pdf and b/pitfall/pitfall/test/test12.pdf differ diff --git a/pitfall/pitfall/test/test12.rkt b/pitfall/pitfall/test/test12.rkt index f3b98066..ebb2adb2 100644 --- a/pitfall/pitfall/test/test12.rkt +++ b/pitfall/pitfall/test/test12.rkt @@ -15,7 +15,7 @@ ;; test against non-subsetted font version (define-runtime-path this "test12rkt.pdf") -(make-doc this #f proc #:pdfkit #f) +(make-doc this #f proc) (define-runtime-path that "test12crkt.pdf") (make-doc that #t proc #:pdfkit #f) diff --git a/pitfall/pitfall/test/test12crkt copy.pdf b/pitfall/pitfall/test/test12crkt copy.pdf index 22392aab..7855b837 100644 Binary files a/pitfall/pitfall/test/test12crkt copy.pdf and b/pitfall/pitfall/test/test12crkt copy.pdf differ diff --git a/pitfall/pitfall/test/test12crkt.pdf b/pitfall/pitfall/test/test12crkt.pdf index 22392aab..7855b837 100644 Binary files a/pitfall/pitfall/test/test12crkt.pdf and b/pitfall/pitfall/test/test12crkt.pdf differ diff --git a/pitfall/pitfall/test/test12rkt copy.pdf b/pitfall/pitfall/test/test12rkt copy.pdf index ffbe68b8..8641980e 100644 Binary files a/pitfall/pitfall/test/test12rkt copy.pdf and b/pitfall/pitfall/test/test12rkt copy.pdf differ diff --git a/pitfall/pitfall/test/test12rkt.pdf b/pitfall/pitfall/test/test12rkt.pdf index ffbe68b8..8641980e 100644 Binary files a/pitfall/pitfall/test/test12rkt.pdf and b/pitfall/pitfall/test/test12rkt.pdf differ