|
|
|
@ -40,6 +40,9 @@
|
|
|
|
|
(define name-string (path->string name))
|
|
|
|
|
(regexp-match (string-downcase (substring family-name 0 (min 6 (string-length family-name)))) (string-downcase name-string)))
|
|
|
|
|
|
|
|
|
|
;; this function follows c sample
|
|
|
|
|
;; https://gist.github.com/CallumDev/7c66b3f9cf7a876ef75f
|
|
|
|
|
|
|
|
|
|
(define (family->path family-name #:bold [bold? #f] #:italic [italic? #f])
|
|
|
|
|
;; create a configuration & invoke it
|
|
|
|
|
(fc-config-set-current (fc-config-create))
|
|
|
|
@ -48,7 +51,8 @@
|
|
|
|
|
[(ormap values fontsets)
|
|
|
|
|
;; query pattern syntax
|
|
|
|
|
;; https://www.freedesktop.org/software/fontconfig/fontconfig-user.html#AEN36
|
|
|
|
|
(define query-pattern (fc-name-parse (string->bytes/utf-8 (format "~a:weight=~a:slant=~a" family-name (if bold? 200 80) (if italic? 100 0)))))
|
|
|
|
|
(define query-pattern
|
|
|
|
|
(fc-name-parse (string->bytes/utf-8 (format "~a:weight=~a:slant=~a" family-name (if bold? 200 80) (if italic? 100 0)))))
|
|
|
|
|
(fc-config-substitute query-pattern 'FcMatchPattern)
|
|
|
|
|
;; https://www.freedesktop.org/software/fontconfig/fontconfig-devel/fcdefaultsubstitute.html
|
|
|
|
|
;; Supplies default values for underspecified font patterns
|
|
|
|
@ -60,4 +64,3 @@
|
|
|
|
|
[(and result (probably-successful-match? family-name result)) result]
|
|
|
|
|
[else #false])]
|
|
|
|
|
[else #false]))
|
|
|
|
|
|