From c60cde7a1694f7ef61d8176942798f11b5cea563 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Fri, 16 Jun 2017 12:46:23 -0700 Subject: [PATCH] remove padding routine --- pitfall/fontkit/directory.rkt | 24 +++++------------------ pitfall/pitfall/test/test12.pdf | Bin 6345 -> 6345 bytes pitfall/pitfall/test/test12.rkt | 2 +- pitfall/pitfall/test/test12crkt copy.pdf | Bin 4474 -> 4475 bytes pitfall/pitfall/test/test12crkt.pdf | Bin 4474 -> 4475 bytes pitfall/pitfall/test/test12rkt copy.pdf | Bin 6354 -> 6345 bytes pitfall/pitfall/test/test12rkt.pdf | Bin 6354 -> 6345 bytes 7 files changed, 6 insertions(+), 20 deletions(-) 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 d84fe023a6077fb78cf4440b1784fae2d53a942c..b9eace51b13f21889ddd19b9ca3664f73d9ce829 100644 GIT binary patch delta 53 xcmX?Uc+zl#921+Fp{0p|$z&BKE4JVe7awo`$tg@%pv=v7%x{@sY(usgLI9{B55E8a delta 53 xcmX?Uc+zl#921*~fq{vM@njVyD>fHj59bKy$tg@%pv=v7%x{@sY(usgLI9u<4`=`Y 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 22392aabdbea267a5c06e190499e999ef5e18d02..7855b83718c2109a44c8c2083070ec28f267a722 100644 GIT binary patch delta 2676 zcmV-)3XApnBKsn+1_A*&lMD_be|=YPY*W`2KleSycH%hpbNn}s?Potfha`q)Y(G1p zj&TzQN&_hil*I!Ypg@6@78P3ck6LBz=%lpUx~-F{uG98q+SoqKXwzhpZlx-kv@aW~ z+ErSms(k6Fs(o46=rm#PocmrJLt%;h?m6fA-FJTH{LZ<@XC8a}2y{aRf2QHU!;e0A z5RAV!@RNAx;irz8`X2zC-jfHPJY}fPckv=0J9*|wQ~xJkD#wl;F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0d4$N1Lan8Pufz8LFiOKtn(&6nX*PH)z zIwOUhdhMvn8y&D`glm}l53kVg0{kZ{1*YqolI%_j3U;t}SMg_+?N6%V-r|fQD#n78|)w|LK=b5I7(t#+13!Xe{J(MwXQ5FOFND(Dch72 zhmJOE8ej3ov8B4MG+sxRi8|`D``z+OQhf~%Lr}z%I!43RU zS9(@yh^gJRuhklh)o`Oyt%u`rWu|dycdc=$8jjcN_$_O0eDYRZx@)HD5py$oB)wwJ|(noHh9u zljLSm=Ciz;p9qvNN{TROGXw)=1^%l6&3VYc%`~4ui0J_X$K(Vf% zLY@K_m|z>% delta 289 zcmX?Uc*$^s8xymUfyHD`CZqZT3=F&?xrr483}C=}1xP7mkq3N)#Y`0Tv)FRZx@)HD3TE?gy4@V|d0mYw|B9 zNk)dvLd@rQH{TN|W0YYKVbEp>1}YHvuLd;gAp^a}09-scIsgCw diff --git a/pitfall/pitfall/test/test12rkt.pdf b/pitfall/pitfall/test/test12rkt.pdf index ffbe68b844cb8cb8780fac8d754308e0aebed258..8641980ec7363ae367aef1f12f1a1dee026427fb 100644 GIT binary patch delta 281 zcmca)c+zl#8xymkrR8K#CZqa&3=F&?xrr483}C=}2}mhqDYRZx@)HD5py$oB)wwJ|(noHh9u zljLSm=Ciz;p9qvNN{TROGXw)=1^%l6&3VYc%`~4ui0J_X$K(Vf% zLY@K_m|z>% delta 289 zcmX?Uc*$^s8xymUfyHD`CZqZT3=F&?xrr483}C=}1xP7mkq3N)#Y`0Tv)FRZx@)HD3TE?gy4@V|d0mYw|B9 zNk)dvLd@rQH{TN|W0YYKVbEp>1}YHvuLd;gAp^a}09-scIsgCw