From fb4e781ac9821d54720990e4f2c5e4617dd7775f Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Sat, 23 Dec 2017 09:10:47 -0800 Subject: [PATCH] add unicode range --- font-face.rkt | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/font-face.rkt b/font-face.rkt index a3677e6..c12ef8e 100644 --- a/font-face.rkt +++ b/font-face.rkt @@ -101,21 +101,29 @@ #:font-style [font-style "normal"] #:font-weight [font-weight "normal"] #:font-stretch [font-stretch "normal"] + #:unicode-range [unicodes #f] #:base64 [base64? #f]) ((string? (or/c urlish? base64-font-string?)) - (#:font-style valid-font-style? #:font-weight valid-font-weight? #:font-stretch valid-font-stretch? #:base64 boolean? #:local (or/c #f string?)) + (#:font-style valid-font-style? + #:font-weight valid-font-weight? + #:font-stretch valid-font-stretch? + #:unicode-range (or/c #f string?) + #:base64 boolean? + #:local (or/c #f string?)) . ->* . string?) (let* ([url (->url src-url)] [url-value (if base64? (path->base64-font-string src-url) (->path url))] [src (format "url('~a') format('~a')" url-value (font-format src-url))] [src (string-append (if local-name (format "local(~v), " local-name) "") src)]) (string-append "@font-face {\n" - (join-css-strings (map make-css-string - '(font-family font-style font-weight font-stretch src) - (list font-family font-style font-weight font-stretch src))) + (join-css-strings (append + (map make-css-string + '(font-family font-style font-weight font-stretch src) + (list font-family font-style font-weight font-stretch src)) + (if unicodes + (list (make-css-string 'unicode-range unicodes)) + null))) "}"))) (define ffd font-face-declaration) -;;(module+ main -;;(display (ffd "Miso" "charter-regular.woff" #:font-style "italic" #:font-weight "700" #:base64 #t))) \ No newline at end of file