From 46a766e4976d3d5381cb91bfbb6b3badf9e9d44b Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Thu, 22 Jun 2017 00:18:18 -0700 Subject: [PATCH] no thing --- pitfall/fontkit/GPOS.rkt | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/pitfall/fontkit/GPOS.rkt b/pitfall/fontkit/GPOS.rkt index 52953e5b..a1f67710 100644 --- a/pitfall/fontkit/GPOS.rkt +++ b/pitfall/fontkit/GPOS.rkt @@ -20,22 +20,29 @@ https://github.com/mbutterick/fontkit/blob/master/src/tables/GPOS.js 'xAdvDevice uint16be ;; pointer 'yAdvDevice uint16be)) ;; pointer +(require racket/dict) + (define-subclass RestructureBase (ValueRecord [key 'valueFormat]) (define/public (buildStruct parent) (define struct parent) - (while (and (not (· struct (· this key))) (· struct parent)) - (hash-set! struct (hash-ref struct parent))) + (report parent) + (while (and (not (with-handlers ([exn:fail:object? (λ (exn) #f)]) + (get-field key struct))) (· struct parent)) + (set! struct (· struct parent))) (cond - [(not (hash-ref struct (· this key))) (void)] - [else (define fields (mhash)) - (hash-set! fields 'rel (λ () (hash-ref struct (error '_startOffset-not-available)))) - - (define format (hash-ref struct (· this key))) + [(report (with-handlers ([exn:fail:object? (λ (exn) #f)]) + (get-field key struct))) (void)] + [else (report (get-field key struct)) + (define fields empty) + (set! fields (dictify 'rel (λ () (hash-ref struct (error '_startOffset-not-available))))) + (define format (get-field key struct)) + +(report* format fields) (for ([key (in-list format)]) - (when (hash-ref format key) - (hash-set! fields key (hash-ref types key)))) + (when (dict-ref format key) + (set! fields (append fields (list (cons key (dict-ref types key))))))) (+Struct fields)])) (define/override (size val ctx)