byte len right

main
Matthew Butterick 6 years ago
parent 6709c9e218
commit a9565a1b3d

@ -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)))]

@ -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!)]))

@ -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

Loading…
Cancel
Save