From 59b25eaacf69d64d6f86fb7197ed12a845f71d96 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Wed, 8 May 2019 11:00:55 -0700 Subject: [PATCH] change font resolution --- quad/quadwriter/font.rkt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/quad/quadwriter/font.rkt b/quad/quadwriter/font.rkt index db8b5f6b..00c83699 100644 --- a/quad/quadwriter/font.rkt +++ b/quad/quadwriter/font.rkt @@ -6,7 +6,7 @@ (provide (all-defined-out)) (define-runtime-path quadwriter-fonts-dir "fonts") -(define-runtime-path default-font-face "fonts/default/regular/SourceSerifPro-Regular.otf") +(define-runtime-path default-font-face "fonts/default/SourceSerifPro-Regular.otf") (define default-font-family "default-serif") (define default-font-size 12) (define default-line-height 16) @@ -44,11 +44,13 @@ #:when (member (path-get-extension font-path) '(#".otf" #".ttf"))) (match-define (list font-path-string family-name) (map (λ (x) (path->string (find-relative-path fonts-dir x))) (list font-path font-family-subdir))) + ;; search for subdir in path matching style name + ;; note that this will work if fonts are contained in another subdirectory (e.g., real font name) (define path-parts (map path->string (explode-path (string->path (string-downcase font-path-string))))) (define key (cons family-name (cond - [(member "bold italic" path-parts) 'bi] + [(member "bold-italic" path-parts) 'bi] [(member "bold" path-parts) 'b] [(member "italic" path-parts) 'i] [else 'r])))