stub out cff table

main
Matthew Butterick 7 years ago
parent f5f235d2a0
commit 53b17e170a

@ -0,0 +1,11 @@
#lang fontkit/racket
(require xenomorph)
(provide (all-defined-out))
#|
approximates
https://github.com/mbutterick/fontkit/blob/master/src/tables/CFF.js
|#
(define CFF_ (+Array (+BufferT)))
(test-module)

@ -16,6 +16,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/TTFFont.js
(test-module
(define f (openSync (path->string charter-path)))
(define otf (openSync (path->string fira-otf-path)))
(check-equal? (postscriptName f) "Charter"))
;; This is the base class for all SFNT-based font formats in fontkit.
@ -209,7 +210,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/TTFFont.js
(string->symbol (bytes->string/latin-1 tag))
tag)))
(define has-cff-table? (curryr has-table? '|CFF |))
(define has-cff-table? (curryr has-table? 'CFF_))
(define has-morx-table? (curryr has-table? 'morx))
(define has-gpos-table? (curryr has-table? 'GPOS))
(define has-gsub-table? (curryr has-table? 'GSUB))
@ -312,4 +313,5 @@ https://github.com/mbutterick/fontkit/blob/master/src/TTFFont.js
(test-module
(check-equal? (measure-string f "f" (· f unitsPerEm)) 321.0)
(check-true (send f has-table? #"cmap"))
(check-exn exn:fail:contract? (λ () (send f _getTable 'nonexistent-table-tag))))
(check-exn exn:fail:contract? (λ () (send f _getTable 'nonexistent-table-tag))))

@ -7,6 +7,7 @@
(define-runtime-path charter-path "../pitfall/test/assets/charter.ttf")
(define-runtime-path charter-italic-path "../pitfall/test/assets/charter-italic.ttf")
(define-runtime-path fira-path "../pitfall/test/assets/fira.ttf")
(define-runtime-path fira-otf-path "../pitfall/test/assets/fira.otf")
(define-runtime-path charter-directory-path "charter-directory.rktd")
(define-runtime-path charter-italic-directory-path "charter-italic-directory.rktd")

@ -10,4 +10,4 @@
(test-module (require (submod TABLE-ID-STRING test) ...))
(define ID (make-hasheq (map cons (list 'TABLE-ID ...) (list TABLE-ID ...)))))))
(define-table-codecs table-codecs maxp hhea head loca prep fpgm hmtx cvt_ glyf OS/2 post GPOS GSUB)
(define-table-codecs table-codecs maxp hhea head loca prep fpgm hmtx cvt_ glyf OS/2 post GPOS GSUB CFF_)
Loading…
Cancel
Save