fontconfig/pattern.scm (make-pattern): Take keyword arguments.
* examples/exmaple.scm: Update accordingly.master
parent
e0683f7bc4
commit
2afa2625c2
|
@ -1,7 +1,7 @@
|
|||
(use-modules (fontconfig))
|
||||
|
||||
(let ((pattern (make-pattern
|
||||
'((family "JuliaMono")))))
|
||||
#:family "JuliaMono" #:style "bold")))
|
||||
(map
|
||||
(lambda (pat)
|
||||
(format #t "
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
(define-module (fontconfig pattern)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 optargs)
|
||||
#:use-module ((fontconfig bindings) #:prefix ffi:)
|
||||
#:use-module (fontconfig object-set)
|
||||
#:use-module (rnrs bytevectors)
|
||||
|
@ -67,7 +68,15 @@
|
|||
(ffi:fontconfig-pattern-add-bool
|
||||
(unwrap-pattern pattern) (symbol->pointer attr) (if value 1 0)))
|
||||
|
||||
(define* (make-pattern #:optional (args '()))
|
||||
(define* (keywords->symbols args #:optional (out '()))
|
||||
(if (>= (length args) 2)
|
||||
(keywords->symbols
|
||||
(cddr args)
|
||||
(cons (list (keyword->symbol (car args)) (cadr args))
|
||||
out))
|
||||
out))
|
||||
|
||||
(define (make-pattern . args)
|
||||
(define bool? (cute member <> %bool-attrs))
|
||||
(define int? (cute member <> %integer-attrs))
|
||||
(define double? (cute member <> %double-attrs))
|
||||
|
@ -85,7 +94,7 @@
|
|||
(((? double? attr) value) pattern-add-double)
|
||||
(((? string? attr) value) pattern-add-string))
|
||||
pattern args))
|
||||
args)
|
||||
(keywords->symbols args))
|
||||
pattern))
|
||||
|
||||
(define (font-list pattern os)
|
||||
|
|
Loading…
Reference in New Issue