From 53b17e170a33949b284ab9cbd4c09600b3179f92 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Sat, 15 Jul 2017 14:34:54 -0700 Subject: [PATCH] stub out cff table --- pitfall/fontkit/CFF_.rkt | 11 +++++++++++ pitfall/fontkit/font.rkt | 6 ++++-- pitfall/fontkit/helper.rkt | 1 + pitfall/fontkit/tables.rkt | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 pitfall/fontkit/CFF_.rkt diff --git a/pitfall/fontkit/CFF_.rkt b/pitfall/fontkit/CFF_.rkt new file mode 100644 index 00000000..6cae8af2 --- /dev/null +++ b/pitfall/fontkit/CFF_.rkt @@ -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) diff --git a/pitfall/fontkit/font.rkt b/pitfall/fontkit/font.rkt index 7249edfc..5037f7c1 100644 --- a/pitfall/fontkit/font.rkt +++ b/pitfall/fontkit/font.rkt @@ -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)))) \ No newline at end of file + (check-exn exn:fail:contract? (λ () (send f _getTable 'nonexistent-table-tag)))) + diff --git a/pitfall/fontkit/helper.rkt b/pitfall/fontkit/helper.rkt index 85925d7a..8d78e763 100644 --- a/pitfall/fontkit/helper.rkt +++ b/pitfall/fontkit/helper.rkt @@ -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") diff --git a/pitfall/fontkit/tables.rkt b/pitfall/fontkit/tables.rkt index 39c996ed..41bcd19b 100644 --- a/pitfall/fontkit/tables.rkt +++ b/pitfall/fontkit/tables.rkt @@ -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) \ No newline at end of file +(define-table-codecs table-codecs maxp hhea head loca prep fpgm hmtx cvt_ glyf OS/2 post GPOS GSUB CFF_) \ No newline at end of file