guile-fontconfig/fontconfig/object-set.scm

42 lines
1.6 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 <object-set>
(make-record-type '<object-set> '(ptr)))
(define %make-object-set (record-constructor <object-set>))
(define unwrap-object-set (record-accessor <object-set> 'ptr))
(define (wrap-object-set ptr)
(%make-object-set
(make-pointer (pointer-address ptr) ffi:fontconfig-object-set-destroy)))
(define (make-object-set)
(let* ((ptr (ffi:fontconfig-object-set-create))
(object-set (wrap-object-set ptr)))
object-set))
(define (object-set-add! os attr)
(ffi:fontconfig-object-set-add (unwrap-object-set os) (string->pointer attr)))