fix searchRange formula

main
Matthew Butterick 7 years ago
parent d107bd0865
commit 63613b6b61

@ -65,7 +65,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/tables/directory.js
(define numTables (length table-headers))
(define searchRange (* (floor (log (/ numTables (log 2)))) 16))
(define searchRange (* (floor (/ (log numTables) (log 2))) 16))
(hash-set*! this-val
'tag "true"
@ -93,8 +93,12 @@ https://github.com/mbutterick/fontkit/blob/master/src/tables/directory.js
(define (directory-decode ip [options (mhash)])
(send Directory decode (+DecodeStream (port->bytes ip))))
(define (file-directory-decode ps)
(directory-decode (open-input-file ps)))
(test-module
(define ip (open-input-file charter-path))
(define decoded-dir (deserialize (read (open-input-file charter-directory-path))))
(check-equal? (directory-decode ip) decoded-dir)
)

@ -284,4 +284,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/TTFFont.js
(send subset encode es)
#;(with-output-to-file "subsetfont.rktd" (λ () (display (send es dump)) ))
(check-equal? (send es dump) (file->bytes "subsetfont.rktd"))
(file-directory-decode "subsetfont.rktd")
(file-directory-decode "../pitfall/test/out.bin")
)

Binary file not shown.
Loading…
Cancel
Save