diff --git a/pitfall/pitfall/core.rkt b/pitfall/pitfall/core.rkt index 8fada01d..495418f4 100644 --- a/pitfall/pitfall/core.rkt +++ b/pitfall/pitfall/core.rkt @@ -19,6 +19,7 @@ current-font-size current-font registered-fonts + font-count line-gap x y diff --git a/pitfall/pitfall/font.rkt b/pitfall/pitfall/font.rkt index 70640318..1441ebd5 100644 --- a/pitfall/pitfall/font.rkt +++ b/pitfall/pitfall/font.rkt @@ -56,7 +56,8 @@ (match (hash-ref (pdf-font-families doc) cache-key #f) ; check if the font is already in the PDF [(? values val) (set-pdf-current-font! doc val)] [_ ; if not, load the font - (define font-index (add1 (length (hash-keys (pdf-font-families doc))))) + (define font-index (add1 (pdf-font-count doc))) + (set-pdf-font-count! doc font-index) (define id (string->symbol (format "F~a" font-index))) (set-pdf-current-font! doc (open-pdf-font src id)) ;; check for existing font families with the same name already in the PDF diff --git a/pitfall/pitfall/pdf.rkt b/pitfall/pitfall/pdf.rkt index e80a44c5..1c1fd9ce 100644 --- a/pitfall/pitfall/pdf.rkt +++ b/pitfall/pitfall/pdf.rkt @@ -47,6 +47,7 @@ (define current-font-size 12) (define current-font #false) (define registered-fonts (make-hash)) + (define font-count 0) (define line-gap 0) (define x 0) (define y 0) @@ -66,6 +67,7 @@ current-font-size current-font registered-fonts + font-count line-gap x y