From 94695ebaf2736b83e946bb6e7f6f18a32f88730c Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Tue, 12 Mar 2019 02:27:44 -0700 Subject: [PATCH] closer --- fontland/fontland/table/cff/cff-dict.rkt | 11 +++++------ fontland/fontland/table/cff/cff-index.rkt | 8 ++++---- fontland/fontland/table/cff/cff-operand.rkt | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/fontland/fontland/table/cff/cff-dict.rkt b/fontland/fontland/table/cff/cff-dict.rkt index 3dfaee08..6456ad7c 100644 --- a/fontland/fontland/table/cff/cff-dict.rkt +++ b/fontland/fontland/table/cff/cff-dict.rkt @@ -121,8 +121,8 @@ https://github.com/mbutterick/fontkit/blob/master/src/cff/CFFDict.js (augment [@encode encode]) (define (@encode dict stream parent) #RRR 'entering-cff-dict-encode - #R @name - #R @fields + #R @name + #R @fields (define ctx (mhasheq x:pointers-key null x:start-offset-key (pos stream) @@ -150,12 +150,11 @@ https://github.com/mbutterick/fontkit/blob/master/src/cff/CFFDict.js (define i 0) (let loop () (when (< i #R (length (hash-ref ctx x:pointers-key))) - (define ptr (list-ref (hash-ref ctx x:pointers-key) i)) - #R ptr + (match (list-ref (hash-ref ctx x:pointers-key) i) + [(x:ptr type val parent) (send type encode val stream parent)]) (set! i (add1 i)) - (send (hash-ref ptr 'type) encode (hash-ref ptr 'val) stream (hash-ref ptr 'parent)) (loop))) #R 'returning-from-cff-dict-encode))) - (define (CFFDict [name 'unknown] [ops null]) (make-object CFFDict% name ops)) \ No newline at end of file +(define (CFFDict [name 'unknown] [ops null]) (make-object CFFDict% name ops)) \ No newline at end of file diff --git a/fontland/fontland/table/cff/cff-index.rkt b/fontland/fontland/table/cff/cff-index.rkt index 723fbbba..133f658f 100644 --- a/fontland/fontland/table/cff/cff-index.rkt +++ b/fontland/fontland/table/cff/cff-index.rkt @@ -107,18 +107,18 @@ https://github.com/mbutterick/fontkit/blob/master/src/cff/CFFIndex.js (error 'cff-index-encode-bad-offset!)])) ;; write offset size - (encode uint8 (size offsetType) stream) + (send uint8 encode (size offsetType) stream) ;; write elements (set! offset 1) - (encode offsetType offset stream) + (send offsetType encode offset stream) (for ([size (in-list sizes)]) (set! offset (+ offset size)) - (encode offsetType offset stream)) + (send offsetType encode offset stream)) (for ([item (in-list arr)]) - (encode type item stream #:parent parent))])))) + (send type encode item stream parent))])))) (define (CFFIndex [type #f]) (new CFFIndex% [type type])) \ No newline at end of file diff --git a/fontland/fontland/table/cff/cff-operand.rkt b/fontland/fontland/table/cff/cff-operand.rkt index e8ba73f6..05e79010 100644 --- a/fontland/fontland/table/cff/cff-operand.rkt +++ b/fontland/fontland/table/cff/cff-operand.rkt @@ -12,7 +12,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/cff/CFFOperand.js (define FLOAT_LOOKUP (vector "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "." "E" "E-" "" "-")) (define FLOAT_ENCODE_LOOKUP - (hasheq "." 10 + (hash "." 10 "E" 11 "E-" 12 "-" 14))