You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
typesetting/pitfall/pitfall/font-open.rkt

17 lines
593 B
Racket

8 years ago
#lang pitfall/racket
8 years ago
(require "standard-font.rkt" "font.rkt" "fontkit.rkt" "embedded.rkt")
8 years ago
(provide PDFFont-open)
(define/contract (PDFFont-open document src family id)
(object? any/c any/c any/c . -> . (is-a?/c PDFFont))
(cond
[(and (string? src) (isStandardFont src))
(make-object StandardFont document src id)]
[else
(define font
(cond
[(string? src) (openSync src family)]
;; todo: other font-loading cases
[else (raise-argument-error 'PDFFont-open "loadable font thingy" src)]))
(make-object EmbeddedFont document font id)]))