font counter

main
Matthew Butterick 6 years ago
parent 08abefbc7b
commit 5a10976df7

@ -19,6 +19,7 @@
current-font-size
current-font
registered-fonts
font-count
line-gap
x
y

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

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

Loading…
Cancel
Save