diff --git a/pitfall/fontkit/gsub-processor.rkt b/pitfall/fontkit/gsub-processor.rkt index fffca581..e105c5db 100644 --- a/pitfall/fontkit/gsub-processor.rkt +++ b/pitfall/fontkit/gsub-processor.rkt @@ -127,14 +127,13 @@ https://github.com/mbutterick/fontkit/blob/master/src/opentype/GSUBProcessor.js (report (for/list ([g (· this glyphs)]) (· g id)) 'step-a) (report matched) (report (· this glyphIterator index)) - (set-field! glyphs this (for*/fold ([gids (· this glyphs)]) - ([idx (in-list (reverse matched))]) - (for/list ([(gid i) (in-indexed gids)] - #:unless (= idx i)) - gid))) - (report (for/list ([g (· this glyphs)]) (· g id)) 'step-b) - (set-field! glyphs this (list-set (· this glyphs) (· this glyphIterator index) ligatureGlyph)) - (set-field! glyphs (· this glyphIterator) (· this glyphs)) + (set-field! glyphs this (for*/list ([(glyph idx) (in-indexed (· this glyphs))] + [midx (in-list matched)] + #:unless (= idx midx)) + (if (= idx (· this glyphIterator index)) + ligatureGlyph + glyph))) + (set-field! glyphs (· this glyphIterator) (· this glyphs)) ; update glyph iterator to keep it in sync (report (for/list ([g (· this glyphs)]) (· g id)) 'step-c) (report (· this glyphIterator index)) #t)] diff --git a/pitfall/sugar/js.rkt b/pitfall/sugar/js.rkt index f7c92862..da388f98 100644 --- a/pitfall/sugar/js.rkt +++ b/pitfall/sugar/js.rkt @@ -44,7 +44,8 @@ (procedure-rename (λ (x . refs) (for/fold ([x x]) - ([ref (in-list refs)]) + ([ref (in-list refs)] + #:break (not x)) (cond ;; give `send` precedence (presence of method => wants runtime resolution of value) [(and (object? x)