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))
|
(use-modules (fontconfig))
|
||||||
|
|
||||||
(let ((pattern (make-pattern
|
(let ((pattern (make-pattern
|
||||||
'((family "JuliaMono")))))
|
#:family "JuliaMono" #:style "bold")))
|
||||||
(map
|
(map
|
||||||
(lambda (pat)
|
(lambda (pat)
|
||||||
(format #t "
|
(format #t "
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
(define-module (fontconfig pattern)
|
(define-module (fontconfig pattern)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
|
#:use-module (ice-9 optargs)
|
||||||
#:use-module ((fontconfig bindings) #:prefix ffi:)
|
#:use-module ((fontconfig bindings) #:prefix ffi:)
|
||||||
#:use-module (fontconfig object-set)
|
#:use-module (fontconfig object-set)
|
||||||
#:use-module (rnrs bytevectors)
|
#:use-module (rnrs bytevectors)
|
||||||
|
@ -67,7 +68,15 @@
|
||||||
(ffi:fontconfig-pattern-add-bool
|
(ffi:fontconfig-pattern-add-bool
|
||||||
(unwrap-pattern pattern) (symbol->pointer attr) (if value 1 0)))
|
(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 bool? (cute member <> %bool-attrs))
|
||||||
(define int? (cute member <> %integer-attrs))
|
(define int? (cute member <> %integer-attrs))
|
||||||
(define double? (cute member <> %double-attrs))
|
(define double? (cute member <> %double-attrs))
|
||||||
|
@ -85,7 +94,7 @@
|
||||||
(((? double? attr) value) pattern-add-double)
|
(((? double? attr) value) pattern-add-double)
|
||||||
(((? string? attr) value) pattern-add-string))
|
(((? string? attr) value) pattern-add-string))
|
||||||
pattern args))
|
pattern args))
|
||||||
args)
|
(keywords->symbols args))
|
||||||
pattern))
|
pattern))
|
||||||
|
|
||||||
(define (font-list pattern os)
|
(define (font-list pattern os)
|
||||||
|
|
Loading…
Reference in New Issue