diff --git a/pitfall/fontkit/directory.rkt b/pitfall/fontkit/directory.rkt index 8db39fb2..b0ed0d99 100644 --- a/pitfall/fontkit/directory.rkt +++ b/pitfall/fontkit/directory.rkt @@ -29,7 +29,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/tables/directory.js (mhash 'tag tag 'checkSum 0 - 'offset #xdeadbeef ; todo + 'offset 16909060 ; todo \1\2\3\4 octal-be 'length (let ([tag (hash-ref table-decoders tag (λ () (raise-argument-error 'directory:preEncode "valid table tag" tag)))]) (send tag size table)))))) (define numTables (length tables)) diff --git a/pitfall/fontkit/font.rkt b/pitfall/fontkit/font.rkt index 7487ae10..6875786e 100644 --- a/pitfall/fontkit/font.rkt +++ b/pitfall/fontkit/font.rkt @@ -281,5 +281,5 @@ https://github.com/mbutterick/fontkit/blob/master/src/TTFFont.js #;(send f _getTable 'maxp) (define subset (make-object TTFSubset f)) (send subset encode (+EncodeStream)) - +(file->bytes "../pitfall/test/out.bin") ) \ No newline at end of file diff --git a/pitfall/fontkit/subset.rkt b/pitfall/fontkit/subset.rkt index c9b51d11..66849ad3 100644 --- a/pitfall/fontkit/subset.rkt +++ b/pitfall/fontkit/subset.rkt @@ -87,6 +87,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/subset/TTFSubset.js (mhash 'tables (mhash 'head head + #| 'hhea hhea 'loca (· this loca) 'maxp maxp @@ -95,9 +96,10 @@ https://github.com/mbutterick/fontkit/blob/master/src/subset/TTFSubset.js 'glyf (· this glyf) 'hmtx (· this hmtx) 'fpgm (send (· this font) _getTable 'fpgm) +|# ))) - (report* (send stream dump)) + (report* (bytes-length (send stream dump)) (send stream dump)) (unfinished) ) diff --git a/pitfall/pdfkit/node_modules/fontkit/index.js b/pitfall/pdfkit/node_modules/fontkit/index.js index 8d7e9fc1..afeed046 100644 --- a/pitfall/pdfkit/node_modules/fontkit/index.js +++ b/pitfall/pdfkit/node_modules/fontkit/index.js @@ -11979,6 +11979,8 @@ var TTFSubset = function (_Subset) { // cmap: cmap } }); + + stream.pipe(fs.createWriteStream('out.bin')); }; return TTFSubset; @@ -12285,7 +12287,7 @@ var TTFFont = (_class = function () { }; TTFFont.prototype._decodeDirectory = function _decodeDirectory() { - console.log("Directory.decode="+Directory.decode) + //console.log("Directory.decode="+Directory.decode) return this.directory = Directory.decode(this.stream, { _startOffset: 0 }); }; diff --git a/pitfall/pitfall/test/out.bin b/pitfall/pitfall/test/out.bin new file mode 100644 index 00000000..f22176fe Binary files /dev/null and b/pitfall/pitfall/test/out.bin differ diff --git a/pitfall/pitfall/test/test12.pdf b/pitfall/pitfall/test/test12.pdf index 74a772a1..d84fe023 100644 Binary files a/pitfall/pitfall/test/test12.pdf and b/pitfall/pitfall/test/test12.pdf differ