guile-fontconfig/fontconfig/object-set.scm

41 lines
1.5 KiB
Scheme

;;; guile-fontconfig --- FFI bindings for FontConfig
;;; Copyright © 2021 Nicolò Balzarotti <nicolo@nixo.xyz>
;;;
;;; This file is part of guile-fontconfig.
;;;
;;; Guile-fontconfig is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Lesser General Public License
;;; as published by the Free Software Foundation; either version 3 of
;;; the License, or (at your option) any later version.
;;;
;;; Guile-fontconfig is distributed in the hope that it will be
;;; useful, but WITHOUT ANY WARRANTY; without even the implied
;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
;;; See the GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU Lesser General Public
;;; License along with guile-fontconfig. If not, see
;;; <http://www.gnu.org/licenses/>.
(define-module (fontconfig object-set)
#:use-module ((fontconfig bindings) #:prefix ffi:)
#:use-module (system foreign)
#:export (make-object-set
unwrap-object-set
object-set-add!))
(define-wrapped-pointer-type <object-set>
object-set?
wrap-object-set unwrap-object-set
(lambda (pattern port)
(format port "#<object-set>")))
(define (make-object-set)
(let* ((ptr (ffi:fontconfig-object-set-create))
(object-set (wrap-object-set ptr)))
(set-pointer-finalizer! ptr ffi:fontconfig-object-set-destroy)
object-set))
(define (object-set-add! os attr)
(ffi:fontconfig-object-set-add (unwrap-object-set os) (string->pointer attr)))