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.
24 lines
674 B
Racket
24 lines
674 B
Racket
#lang racket/base
|
|
(require
|
|
racket/class
|
|
racket/contract
|
|
"standard-font.rkt"
|
|
"font.rkt"
|
|
fontland
|
|
"embedded.rkt")
|
|
(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) (open-font src)]
|
|
[(path? src) (open-font (path->string src))]
|
|
;; todo: other font-loading cases
|
|
[else (raise-argument-error 'PDFFont-open "loadable font thingy" src)]))
|
|
(make-object EmbeddedFont document font id)]))
|