From a9565a1b3d38b60d49a0ff7e0ce45c78b9a44973 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Tue, 12 Mar 2019 11:20:12 -0700 Subject: [PATCH] byte len right --- fontland/fontland/table/cff/cff-dict.rkt | 2 ++ fontland/fontland/table/cff/cff-index.rkt | 10 +++++----- fontland/fontland/table/cff/cff-operand.rkt | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fontland/fontland/table/cff/cff-dict.rkt b/fontland/fontland/table/cff/cff-dict.rkt index 46d170b8..b1e25e8c 100644 --- a/fontland/fontland/table/cff/cff-dict.rkt +++ b/fontland/fontland/table/cff/cff-dict.rkt @@ -130,6 +130,8 @@ https://github.com/mbutterick/fontkit/blob/master/src/cff/CFFDict.js (hash-set! ctx x:pointer-offset-key (+ (pos stream) (@size dict ctx #false))) (for ([field (in-list @ops)]) + #R (pos stream) + #R field (define val (dict-ref dict (list-ref field 1) #false)) (cond [(or (not val) (equal? val (list-ref field 3)))] diff --git a/fontland/fontland/table/cff/cff-index.rkt b/fontland/fontland/table/cff/cff-index.rkt index c96aa232..be366629 100644 --- a/fontland/fontland/table/cff/cff-index.rkt +++ b/fontland/fontland/table/cff/cff-index.rkt @@ -24,13 +24,13 @@ https://github.com/mbutterick/fontkit/blob/master/src/cff/CFFIndex.js (define (@decode stream parent) (match (decode (if (>= (getCFFVersion parent) 2) uint32be uint16be) stream) [0 null] - [count (define offSize (decode uint8 stream)) + [count (define offSize (decode uint8 stream)) (define offsetType (match offSize [1 uint8] [2 uint16be] [3 uint24be] [4 uint32be] - [_ (error 'bad-offset-size-in-CFFIndex)])) + [_ (error (format "bad-offset-size-in-CFFIndex ~a" offSize))])) (define startPos (+ (pos stream) (* (add1 count) offSize) -1)) (for/fold ([vals null] [start (send offsetType decode stream)] @@ -98,11 +98,11 @@ https://github.com/mbutterick/fontkit/blob/master/src/cff/CFFIndex.js [(<= offset #xff) uint8] [(<= offset #xffff) - uint16] + uint16be] [(<= offset #xffffff) - uint24] + uint24be] [(<= offset #xffffffff) - uint32] + uint32be] [else (error 'cff-index-encode-bad-offset!)])) diff --git a/fontland/fontland/table/cff/cff-operand.rkt b/fontland/fontland/table/cff/cff-operand.rkt index 05e79010..1fa775e0 100644 --- a/fontland/fontland/table/cff/cff-operand.rkt +++ b/fontland/fontland/table/cff/cff-operand.rkt @@ -77,7 +77,7 @@ https://github.com/mbutterick/fontkit/blob/master/src/cff/CFFOperand.js (define val (if value (string->number (format "~a" value)) 0)) (cond - [(and (hash? value-arg) (hash-ref value-arg 'forceLarge #f)) + [(and (Ptr? value-arg) (Ptr-forceLarge value-arg)) (encode uint8 29 stream) (encode int32be val stream)] [(not (integer? val)) ;; floating point