diff --git a/pitfall/pitfall/font-standard.rkt b/pitfall/pitfall/font-standard.rkt index d8e70221..29757a3c 100644 --- a/pitfall/pitfall/font-standard.rkt +++ b/pitfall/pitfall/font-standard.rkt @@ -29,7 +29,7 @@ (define line-gap (- (third bbox) (first bbox) ascender descender)) (sfont name id ascender descender line-gap bbox #f #f sfont-embed sfont-encode sfont-measure-string - attributes glyph-widths kern-pairs)) + attributes glyph-widths kern-pairs)) (define (sfont-embed sf) (set-$ref-payload! (pdf-font-ref sf) @@ -52,9 +52,11 @@ (hash-ref (sfont-glyph-widths sf) glyph 0)) (define (advances-for-glyphs sf glyphs) - (for/list ([left (in-list glyphs)] - [right (in-list (append (cdr glyphs) (list #\nul)))]) - (+ (glyph-width sf left) (get-kern-pair sf left right)))) + (if (empty? glyphs) + empty + (for/list ([left (in-list glyphs)] + [right (in-list (append (cdr glyphs) (list #\nul)))]) + (+ (glyph-width sf left) (get-kern-pair sf left right))))) (define (get-kern-pair sf left right) (hash-ref (sfont-kern-pairs sf) (make-kern-table-key left right) 0))