2003-10-13 11:27:19 -04:00
|
|
|
|
2004-04-25 05:27:40 -04:00
|
|
|
;; *object-table* maps each Xft object (identified by its memory
|
|
|
|
;; address) to the correspoding Scheme object. This avoids situations
|
|
|
|
;; where we have two pointer Scheme objects for one Xft object. In
|
|
|
|
;; these situations we would call the finalizer (Xft free() operation)
|
|
|
|
;; on twice on the same object. This may crash the system, or, at
|
|
|
|
;; least print bogus error messages.
|
|
|
|
;; Key is an integer (memory address of the Xft structure), value a
|
|
|
|
;; weak pointer to the Scheme object.
|
|
|
|
|
|
|
|
(define *object-table*
|
|
|
|
(make-value-weak-table))
|
|
|
|
|
|
|
|
(define (register-xft-pointer! pointer object)
|
|
|
|
(add-to-weak-table! *object-table* pointer object))
|
|
|
|
|
|
|
|
(define (unregister-xft-pointer! pointer)
|
|
|
|
(remove-from-weak-table! *object-table* pointer))
|
|
|
|
|
|
|
|
(define (lookup-xft-pointer pointer)
|
|
|
|
(lookup-in-weak-table *object-table* pointer))
|
|
|
|
|
|
|
|
;; types
|
|
|
|
|
2003-10-13 11:27:19 -04:00
|
|
|
(define-record-type xft-pattern :xft-pattern
|
|
|
|
(really-make-xft-pattern c-pointer)
|
|
|
|
xft-pattern?
|
|
|
|
(c-pointer xft-pattern-c-pointer))
|
|
|
|
|
|
|
|
(define-exported-binding "xft-pattern" :xft-pattern)
|
|
|
|
|
|
|
|
(define-record-type xft-font :xft-font
|
2003-10-26 11:42:31 -05:00
|
|
|
(make-xft-font c-pointer pattern)
|
2003-10-13 11:27:19 -04:00
|
|
|
xft-font?
|
2003-10-26 11:42:31 -05:00
|
|
|
(c-pointer xft-font-c-pointer)
|
2003-10-26 14:00:42 -05:00
|
|
|
(pattern xft-font-pattern)
|
|
|
|
(display xft-font-display))
|
2003-10-13 11:27:19 -04:00
|
|
|
|
|
|
|
(define-exported-binding "xft-font" :xft-font)
|
|
|
|
|
|
|
|
(define-record-type xft-draw :xft-draw
|
2003-10-28 05:28:25 -05:00
|
|
|
(make-xft-draw-internal c-pointer)
|
2003-10-16 12:05:03 -04:00
|
|
|
xft-draw?
|
2003-10-13 11:27:19 -04:00
|
|
|
(c-pointer xft-draw-c-pointer))
|
|
|
|
|
|
|
|
(define-exported-binding "xft-draw" :xft-draw)
|
|
|
|
|
|
|
|
(define-record-type xft-color :xft-color
|
2003-10-27 05:06:25 -05:00
|
|
|
(make-xft-color-internal c-pointer display visual colormap)
|
2003-10-13 11:27:19 -04:00
|
|
|
xft-color?
|
2003-10-17 04:38:24 -04:00
|
|
|
(c-pointer xft-color-c-pointer)
|
|
|
|
(display xft-color-display set-xft-color-display!)
|
|
|
|
(visual xft-color-visual set-xft-color-visual!)
|
|
|
|
(colormap xft-color-colormap set-xft-color-colormap!))
|
2003-10-13 11:27:19 -04:00
|
|
|
|
|
|
|
(define-exported-binding "xft-color" :xft-color)
|
|
|
|
|
|
|
|
(define-record-type xft-objectset :xft-objectset
|
|
|
|
(make-xft-objectset c-pointer)
|
|
|
|
xft-objectset?
|
|
|
|
(c-pointer xft-objectset-c-pointer))
|
|
|
|
|
|
|
|
(define-exported-binding "xft-objectset" :xft-objectset)
|
|
|
|
|
|
|
|
(define-record-type xft-fontset :xft-fontset
|
2004-04-27 12:15:19 -04:00
|
|
|
(really-make-xft-fontset c-pointer)
|
2003-10-13 11:27:19 -04:00
|
|
|
xft-fontset?
|
2004-04-27 12:15:19 -04:00
|
|
|
(c-pointer xft-fontset-c-pointer))
|
2003-10-13 11:27:19 -04:00
|
|
|
|
|
|
|
(define-exported-binding "xft-fontset" :xft-fontset)
|
|
|
|
|
2003-10-25 09:20:47 -04:00
|
|
|
(define-syntax lookup-shared-valued
|
|
|
|
(syntax-rules ()
|
|
|
|
((lookup-shared-valued str)
|
|
|
|
(shared-binding-ref
|
|
|
|
(lookup-imported-binding str)))))
|
|
|
|
|
|
|
|
(define-finite-type xft-pattern-object :xft-pattern-object
|
|
|
|
(id)
|
|
|
|
xft-pattern-object?
|
|
|
|
xft-pattern-object-elements
|
|
|
|
xft-pattern-object-name
|
|
|
|
xft-pattern-object-index
|
|
|
|
(id xft-pattern-object-id)
|
|
|
|
((family (lookup-shared-valued "scx-xft-pattern-family"))
|
|
|
|
(style (lookup-shared-valued "scx-xft-pattern-style"))
|
|
|
|
(slant (lookup-shared-valued "scx-xft-pattern-slant"))
|
|
|
|
(weight (lookup-shared-valued "scx-xft-pattern-weight"))
|
|
|
|
(size (lookup-shared-valued "scx-xft-pattern-size"))
|
|
|
|
(pixel-size (lookup-shared-valued "scx-xft-pattern-pixel-size"))
|
|
|
|
(encoding (lookup-shared-valued "scx-xft-pattern-encoding"))
|
|
|
|
(spacing (lookup-shared-valued "scx-xft-pattern-spacing"))
|
|
|
|
(foundry (lookup-shared-valued "scx-xft-pattern-foundry"))
|
|
|
|
(core (lookup-shared-valued "scx-xft-pattern-core"))
|
|
|
|
(antialias (lookup-shared-valued "scx-xft-pattern-antialias"))
|
|
|
|
(xlfd (lookup-shared-valued "scx-xft-pattern-xlfd"))
|
|
|
|
(file (lookup-shared-valued "scx-xft-pattern-file"))
|
|
|
|
(index (lookup-shared-valued "scx-xft-pattern-index"))
|
|
|
|
(rasterizer (lookup-shared-valued "scx-xft-pattern-rasterizer"))
|
|
|
|
(outline (lookup-shared-valued "scx-xft-pattern-outline"))
|
|
|
|
(scalable (lookup-shared-valued "scx-xft-pattern-scalable"))
|
|
|
|
(rgba (lookup-shared-valued "scx-xft-pattern-rgba"))
|
|
|
|
(scale (lookup-shared-valued "scx-xft-pattern-scale"))
|
|
|
|
(render (lookup-shared-valued "scx-xft-pattern-render"))
|
|
|
|
(minspace (lookup-shared-valued "scx-xft-pattern-minspace"))
|
|
|
|
(dpi (lookup-shared-valued "scx-xft-pattern-dpi"))
|
|
|
|
(char-width (lookup-shared-valued "scx-xft-pattern-char-width"))
|
|
|
|
(char-height (lookup-shared-valued "scx-xft-pattern-char-height"))))
|
|
|
|
|
2003-10-25 12:24:46 -04:00
|
|
|
(define-finite-type xft-weight :xft-weight
|
|
|
|
(id)
|
|
|
|
xft-weight?
|
|
|
|
xft-weight-elements
|
|
|
|
xft-weight-name
|
|
|
|
xft-weight-index
|
|
|
|
(id xft-weight-id)
|
|
|
|
((light (lookup-shared-valued "scx-xft-weight-light"))
|
|
|
|
(medium (lookup-shared-valued "scx-xft-weight-medium"))
|
|
|
|
(demibold (lookup-shared-valued "scx-xft-weight-demibold"))
|
|
|
|
(bold (lookup-shared-valued "scx-xft-weight-bold"))
|
|
|
|
(black (lookup-shared-valued "scx-xft-weight-black"))))
|
|
|
|
|
|
|
|
(define-finite-type xft-slant :xft-slant
|
|
|
|
(id)
|
|
|
|
xft-slant?
|
|
|
|
xft-slant-elements
|
|
|
|
xft-slant-name
|
|
|
|
xft-slant-index
|
|
|
|
(id xft-slant-id)
|
|
|
|
((roman (lookup-shared-valued "scx-xft-slant-roman"))
|
|
|
|
(italic (lookup-shared-valued "scx-xft-slant-italic"))
|
|
|
|
(oblique (lookup-shared-valued "scx-xft-slant-oblique"))))
|
|
|
|
|
|
|
|
(define-finite-type xft-spacing :xft-spacing
|
|
|
|
(id)
|
|
|
|
xft-spacing?
|
|
|
|
xft-spacing-elements
|
|
|
|
xft-spacing-name
|
|
|
|
xft-spacing-index
|
|
|
|
(id xft-spacing-id)
|
|
|
|
((proportional (lookup-shared-valued "scx-xft-spacing-proportional"))
|
|
|
|
(mono (lookup-shared-valued "scx-xft-spacing-mono"))
|
|
|
|
(charcell (lookup-shared-valued "scx-xft-spacing-charcell"))))
|
|
|
|
|
|
|
|
(define-finite-type xft-rgba :xft-rgba
|
|
|
|
(id)
|
|
|
|
xft-rgba?
|
|
|
|
xft-rgba-elements
|
|
|
|
xft-rgba-name
|
|
|
|
xft-rgba-index
|
|
|
|
(id xft-rgba-id)
|
|
|
|
((none (lookup-shared-valued "scx-xft-rgba-none"))
|
|
|
|
(rgb (lookup-shared-valued "scx-xft-rgba-rgb"))
|
|
|
|
(bgr (lookup-shared-valued "scx-xft-rgba-bgr"))
|
|
|
|
(vrgb (lookup-shared-valued "scx-xft-rgba-vrgb"))
|
|
|
|
(vbgr (lookup-shared-valued "scx-xft-rgba-vbgr"))))
|
|
|
|
|
|
|
|
(define (make-finite-type-alist elements id-proc)
|
|
|
|
(map (lambda (e)
|
|
|
|
(cons (id-proc e) e))
|
|
|
|
(vector->list elements)))
|
|
|
|
|
|
|
|
(define xft-weight-id->xft-weight
|
|
|
|
(let ((alist
|
|
|
|
(make-finite-type-alist xft-weight-elements xft-weight-id)))
|
|
|
|
(lambda (id)
|
|
|
|
(cond
|
|
|
|
((assoc id alist) => cdr)
|
|
|
|
(else
|
|
|
|
(error "scx: internal error. Could not map weight id to finite type"))))))
|
|
|
|
|
|
|
|
(define xft-slant-id->xft-slant
|
|
|
|
(let ((alist
|
|
|
|
(make-finite-type-alist xft-slant-elements xft-slant-id)))
|
|
|
|
(lambda (id)
|
|
|
|
(cond
|
|
|
|
((assoc id alist) => cdr)
|
|
|
|
(else
|
|
|
|
(error "scx: internal error. Could not map slant id to finite type"))))))
|
|
|
|
|
|
|
|
(define xft-spacing-id->xft-spacing
|
|
|
|
(let ((alist
|
|
|
|
(make-finite-type-alist xft-spacing-elements xft-spacing-id)))
|
|
|
|
(lambda (id)
|
|
|
|
(cond
|
|
|
|
((assoc id alist) => cdr)
|
|
|
|
(else
|
|
|
|
(error "scx: internal error. Could not map spacing id to finite type"))))))
|
|
|
|
|
|
|
|
(define xft-rgba-id->xft-rgba
|
|
|
|
(let ((alist
|
|
|
|
(make-finite-type-alist xft-rgba-elements xft-rgba-id)))
|
|
|
|
(lambda (id)
|
|
|
|
(cond
|
|
|
|
((assoc id alist) => cdr)
|
|
|
|
(else
|
|
|
|
(error "scx: internal error. Could not map rgba id to finite type"))))))
|
|
|
|
|
2004-04-25 05:27:40 -04:00
|
|
|
(define (xft-pattern-finalizer pattern)
|
|
|
|
(unregister-xft-pointer! (xft-pattern-c-pointer pattern))
|
|
|
|
(xft-pattern-destroy pattern))
|
|
|
|
|
|
|
|
(define (xft-color-finalizer color)
|
2004-04-27 12:15:19 -04:00
|
|
|
(unregister-xft-pointer! (xft-color-c-pointer color))
|
|
|
|
(xft-color-free (xft-color-display color)
|
|
|
|
(xft-color-visual color)
|
2004-04-25 05:27:40 -04:00
|
|
|
(xft-color-colormap color)
|
|
|
|
color))
|
|
|
|
|
|
|
|
(define (xft-draw-finalizer draw)
|
2004-04-27 12:15:19 -04:00
|
|
|
(unregister-xft-pointer! (xft-draw-c-pointer draw))
|
|
|
|
(xft-draw-destroy draw))
|
2004-04-25 05:27:40 -04:00
|
|
|
|
|
|
|
(define (xft-objectset-finalizer objectset)
|
2004-04-27 12:15:19 -04:00
|
|
|
(unregister-xft-pointer! (xft-objectset-c-pointer objectset))
|
|
|
|
(xft-objectset-destroy objectset))
|
2004-04-25 05:27:40 -04:00
|
|
|
|
|
|
|
(define (xft-font-finalizer font)
|
|
|
|
(unregister-xft-pointer! (xft-font-c-pointer font))
|
|
|
|
(xft-font-close-internal font))
|
2003-10-13 11:27:19 -04:00
|
|
|
|
|
|
|
(define (make-xft-pattern)
|
2003-10-27 05:06:25 -05:00
|
|
|
(let ((pattern (xft-pattern-create)))
|
2004-04-25 05:27:40 -04:00
|
|
|
(or (lookup-xft-pointer (xft-pattern-c-pointer pattern))
|
|
|
|
(begin
|
|
|
|
(register-xft-pointer! (xft-pattern-c-pointer pattern) pattern)
|
|
|
|
(add-finalizer! pattern xft-pattern-finalizer)
|
|
|
|
pattern))))
|
2003-10-13 11:27:19 -04:00
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (xft-pattern-duplicate pattern)
|
2004-04-25 05:27:40 -04:00
|
|
|
(let* ((copy (xft-pattern-duplicate-internal pattern))
|
|
|
|
(pointer (xft-pattern-c-pointer copy)))
|
|
|
|
(or (lookup-xft-pointer pointer)
|
|
|
|
(begin
|
|
|
|
(register-xft-pointer! pointer copy)
|
|
|
|
(add-finalizer! copy xft-pattern-finalizer)
|
|
|
|
copy))))
|
2003-10-13 11:27:19 -04:00
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (xft-pattern-get pattern object id)
|
2003-10-25 12:24:46 -04:00
|
|
|
(let ((object-id (xft-pattern-object-id object)))
|
|
|
|
(call-with-values
|
|
|
|
(lambda ()
|
|
|
|
(apply values
|
2003-10-27 05:06:25 -05:00
|
|
|
(xft-pattern-get-internal pattern object-id id)))
|
2003-10-25 12:24:46 -04:00
|
|
|
(lambda (code value)
|
|
|
|
(values code
|
|
|
|
(cond
|
2003-10-27 05:06:25 -05:00
|
|
|
((not (xft-result-match? code))
|
2003-10-25 12:24:46 -04:00
|
|
|
#f)
|
|
|
|
((equal? object (xft-pattern-object weight))
|
|
|
|
(xft-weight-id->xft-weight value))
|
|
|
|
((equal? object (xft-pattern-object slant))
|
|
|
|
(xft-slant-id->xft-slant value))
|
|
|
|
((equal? object (xft-pattern-object spacing))
|
|
|
|
(xft-spacing-id->xft-spacing value))
|
|
|
|
((equal? object (xft-pattern-object rgba))
|
|
|
|
(xft-rgba-id->xft-rgba value))
|
|
|
|
(else value)))))))
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (xft-pattern-add pattern object value append?)
|
2003-10-25 12:24:46 -04:00
|
|
|
(let* ((object-id (xft-pattern-object-id object))
|
|
|
|
(call (lambda (value)
|
2003-10-27 05:06:25 -05:00
|
|
|
(xft-pattern-add-internal
|
2003-10-25 12:24:46 -04:00
|
|
|
pattern object-id value append?))))
|
|
|
|
(cond
|
|
|
|
((equal? object (xft-pattern-object weight))
|
|
|
|
(call (xft-weight-id value)))
|
|
|
|
((equal? object (xft-pattern-object slant))
|
|
|
|
(call (xft-slant-id value)))
|
|
|
|
((equal? object (xft-pattern-object spacing))
|
|
|
|
(call (xft-spacing-id value)))
|
|
|
|
((equal? object (xft-pattern-object rgba))
|
|
|
|
(call (xft-rgba-id value)))
|
|
|
|
(else (call value)))))
|
2003-10-25 09:20:47 -04:00
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (xft-font-match display screen pattern)
|
2003-10-13 11:27:19 -04:00
|
|
|
(call-with-values
|
2003-10-16 12:05:03 -04:00
|
|
|
(lambda ()
|
2003-10-17 04:38:24 -04:00
|
|
|
(let ((screen-number (screen:number screen)))
|
2003-10-27 02:49:20 -05:00
|
|
|
(apply values
|
2003-10-27 05:06:25 -05:00
|
|
|
(xft-font-match-internal display screen-number pattern))))
|
|
|
|
(lambda (result pattern)
|
2004-04-25 05:27:40 -04:00
|
|
|
(let ((pointer (xft-pattern-c-pointer pattern)))
|
|
|
|
(cond
|
|
|
|
((lookup-xft-pointer pointer)
|
|
|
|
=> (lambda (obj) (values result obj)))
|
|
|
|
(else
|
|
|
|
(register-xft-pointer! (xft-pattern-c-pointer pattern) pattern)
|
2004-04-27 12:15:19 -04:00
|
|
|
;(add-finalizer! pattern xft-pattern-finalizer)
|
2004-04-25 05:27:40 -04:00
|
|
|
(values result pattern)))))))
|
2003-10-26 14:00:42 -05:00
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (xft-font-open-pattern display pattern)
|
|
|
|
(let ((font (xft-font-open-pattern-internal display pattern)))
|
2004-04-25 05:27:40 -04:00
|
|
|
(or (lookup-xft-pointer (xft-font-c-pointer font))
|
|
|
|
(begin
|
|
|
|
(register-xft-pointer! (xft-font-c-pointer font) font)
|
|
|
|
(add-finalizer! font xft-font-finalizer)
|
|
|
|
font))))
|
2003-10-13 11:27:19 -04:00
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (xft-font-open-name display screen name)
|
2003-10-17 04:38:24 -04:00
|
|
|
(let* ((screen-number (screen:number screen))
|
2003-10-27 05:06:25 -05:00
|
|
|
(font (xft-font-open-name-internal display screen-number name)))
|
2004-04-25 05:27:40 -04:00
|
|
|
(or (lookup-xft-pointer (xft-font-c-pointer font))
|
|
|
|
(begin
|
|
|
|
(register-xft-pointer! (xft-font-c-pointer font) font)
|
|
|
|
(add-finalizer! font xft-font-finalizer)
|
|
|
|
font))))
|
2003-10-13 11:27:19 -04:00
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (xft-font-open-xlfd display screen name)
|
2003-10-17 04:38:24 -04:00
|
|
|
(let* ((screen-numer (screen:number screen))
|
2003-10-27 05:06:25 -05:00
|
|
|
(font (xft-font-open-xlfd-internal display screen-numer name)))
|
2004-04-27 12:15:19 -04:00
|
|
|
(or (lookup-xft-pointer (xft-font-c-pointer font))
|
2004-04-25 05:27:40 -04:00
|
|
|
(begin
|
|
|
|
(register-xft-pointer! (xft-font-c-pointer font) font)
|
|
|
|
(add-finalizer! font xft-font-finalizer)
|
|
|
|
font))))
|
2003-10-13 11:27:19 -04:00
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (make-xft-draw display drawable visual colormap)
|
|
|
|
(let ((draw (xft-draw-create-internal display drawable visual colormap)))
|
2004-04-25 05:27:40 -04:00
|
|
|
(or (lookup-xft-pointer (xft-draw-c-pointer draw))
|
|
|
|
(begin
|
|
|
|
(register-xft-pointer! (xft-draw-c-pointer draw) draw)
|
|
|
|
(add-finalizer! draw xft-draw-finalizer)
|
|
|
|
draw))))
|
2003-10-13 11:27:19 -04:00
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (make-xft-draw-bitmap display drawable)
|
|
|
|
(let ((draw (xft-draw-create-bitmap-internal display drawable)))
|
2004-04-25 05:27:40 -04:00
|
|
|
(or (lookup-xft-pointer (xft-draw-c-pointer draw))
|
|
|
|
(begin
|
|
|
|
(register-xft-pointer! (xft-draw-c-pointer draw) draw)
|
|
|
|
(add-finalizer! draw xft-draw-finalizer)
|
|
|
|
draw))))
|
2003-10-13 11:27:19 -04:00
|
|
|
|
|
|
|
(define (make-xft-objectset)
|
2003-10-27 05:06:25 -05:00
|
|
|
(let ((objectset (xft-objectset-create)))
|
2004-04-25 05:27:40 -04:00
|
|
|
(or (lookup-xft-pointer (xft-objectset-c-pointer objectset))
|
|
|
|
(begin
|
|
|
|
(register-xft-pointer! (xft-objectset-c-pointer objectset)
|
|
|
|
objectset)
|
|
|
|
(add-finalizer! objectset xft-objectset-finalizer)
|
|
|
|
objectset))))
|
2003-10-13 11:27:19 -04:00
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (xft-objectset-add objectset pattern-object)
|
|
|
|
(xft-objectset-add-internal
|
|
|
|
objectset (xft-pattern-object-id pattern-object)))
|
2003-10-25 09:20:47 -04:00
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (xft-draw-display draw)
|
|
|
|
(let ((display (xft-draw-display-internal draw)))
|
2004-04-25 05:27:40 -04:00
|
|
|
(or display
|
2003-10-14 11:27:33 -04:00
|
|
|
(error "XftDrawDisplay() unavailable in this version of Xft"))))
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (xft-draw-drawable draw)
|
|
|
|
(let ((drawable (xft-draw-drawable-internal draw)))
|
2004-04-25 05:27:40 -04:00
|
|
|
(or drawable
|
2003-10-14 11:27:33 -04:00
|
|
|
(error "XftDrawDrawable() unavailable in this version of Xft"))))
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (xft-draw-colormap draw)
|
|
|
|
(let ((colormap (xft-draw-colormap-internal draw)))
|
2004-04-25 05:27:40 -04:00
|
|
|
(or colormap
|
2003-10-14 11:27:33 -04:00
|
|
|
(error "XftDrawColormap() unavailable in this version of Xft"))))
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (xft-draw-visual draw)
|
|
|
|
(let ((visual (xft-draw-visual-internal draw)))
|
2004-04-25 05:27:40 -04:00
|
|
|
(or visual
|
2003-10-14 11:27:33 -04:00
|
|
|
(error "XftDrawVisual() unavailable in this version of Xft"))))
|
|
|
|
|
2004-04-27 12:15:19 -04:00
|
|
|
(define (fontset->list-of-patterns fs)
|
|
|
|
(let ((count (xft-fontset-count fs)))
|
|
|
|
(unfold
|
|
|
|
(lambda (x)
|
|
|
|
(equal? count x))
|
|
|
|
(lambda (index)
|
|
|
|
(xft-pattern-duplicate
|
|
|
|
(xft-fontset-ref fs index)))
|
|
|
|
(lambda (x)
|
|
|
|
(+ x 1))
|
|
|
|
0)))
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (xft-list-fonts-pattern-objects display screen pattern objectset)
|
2003-10-17 04:38:24 -04:00
|
|
|
(let* ((screen-number (screen:number screen))
|
2003-10-27 05:06:25 -05:00
|
|
|
(fontset (xft-list-fonts-pattern-objects-internal
|
|
|
|
display screen-number pattern objectset)))
|
2004-04-27 12:15:19 -04:00
|
|
|
(let ((patterns (fontset->list-of-patterns fontset)))
|
|
|
|
(xft-fontset-destroy fontset)
|
|
|
|
patterns)))
|
2004-04-25 05:27:40 -04:00
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (xft-color-alloc-name display visual colormap name)
|
2003-10-23 13:18:55 -04:00
|
|
|
(call-with-values
|
|
|
|
(lambda ()
|
|
|
|
(apply values
|
2003-10-27 05:06:25 -05:00
|
|
|
(xft-color-alloc-name-internal display visual colormap name)))
|
|
|
|
(lambda (success? color)
|
2003-10-23 13:18:55 -04:00
|
|
|
(if success?
|
|
|
|
(begin
|
2003-10-27 05:06:25 -05:00
|
|
|
(set-xft-color-display! color display)
|
|
|
|
(set-xft-color-visual! color visual)
|
|
|
|
(set-xft-color-colormap! color colormap)
|
|
|
|
(add-finalizer! color xft-color-finalizer)
|
|
|
|
color)
|
2003-10-23 13:18:55 -04:00
|
|
|
;;; FIXME: raise error
|
|
|
|
#f))))
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define (xft-color-alloc-value display visual colormap xrendercolor)
|
2003-10-24 02:27:02 -04:00
|
|
|
(call-with-values
|
|
|
|
(lambda ()
|
|
|
|
(apply values
|
2003-10-27 05:06:25 -05:00
|
|
|
(xft-color-alloc-value-internal display visual colormap xrendercolor)))
|
|
|
|
(lambda (success? color)
|
|
|
|
(set-xft-color-display! color display)
|
|
|
|
(set-xft-color-visual! color visual)
|
|
|
|
(set-xft-color-colormap! color colormap)
|
|
|
|
(add-finalizer! color xft-color-finalizer)
|
|
|
|
color)))
|
|
|
|
|
|
|
|
(define (xft-default-substitute display screen pattern)
|
|
|
|
(xft-default-substitute-internal display (screen:number screen) pattern))
|
2003-10-26 14:00:42 -05:00
|
|
|
|
2003-10-16 12:05:03 -04:00
|
|
|
;;; import values from C code
|
2003-10-27 05:06:25 -05:00
|
|
|
(define xft-version-major
|
2003-10-16 12:05:03 -04:00
|
|
|
(shared-binding-ref
|
|
|
|
(lookup-imported-binding "scx-xft-version-major")))
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define xft-version-minor
|
2003-10-16 12:05:03 -04:00
|
|
|
(shared-binding-ref
|
|
|
|
(lookup-imported-binding "scx-xft-version-minor")))
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define xft-result-match?
|
2003-10-25 09:48:04 -04:00
|
|
|
(let ((code (shared-binding-ref
|
|
|
|
(lookup-imported-binding "scx-xft-result-match"))))
|
|
|
|
(lambda (value)
|
|
|
|
(equal? value code))))
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define xft-result-no-match?
|
2003-10-25 09:48:04 -04:00
|
|
|
(let ((code (shared-binding-ref
|
|
|
|
(lookup-imported-binding "scx-xft-result-no-match"))))
|
|
|
|
(lambda (value)
|
|
|
|
(equal? value code))))
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define xft-result-type-mismatch?
|
2003-10-25 09:48:04 -04:00
|
|
|
(let ((code (shared-binding-ref
|
|
|
|
(lookup-imported-binding "scx-xft-result-type-mismatch"))))
|
|
|
|
(lambda (value)
|
|
|
|
(equal? value code))))
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(define xft-result-no-id?
|
2003-10-25 09:48:04 -04:00
|
|
|
(let ((code (shared-binding-ref
|
|
|
|
(lookup-imported-binding "scx-xft-result-no-id"))))
|
|
|
|
(lambda (value)
|
|
|
|
(equal? value code))))
|
2003-10-16 12:05:03 -04:00
|
|
|
|
2003-10-13 11:27:19 -04:00
|
|
|
;;; import functions from C code
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-pattern-create
|
2003-10-13 11:27:19 -04:00
|
|
|
()
|
|
|
|
"scx_XftPatternCreate")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-pattern-destroy
|
2004-04-25 05:27:40 -04:00
|
|
|
(pattern)
|
2003-10-16 12:05:03 -04:00
|
|
|
"scx_XftPatternDestroy")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-pattern-duplicate-internal
|
|
|
|
(pattern)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftPatternDuplicate")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-pattern-get-internal
|
|
|
|
(pattern object id)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftPatternGet")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-pattern-add-internal
|
|
|
|
(pattern object value append?)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftPatternAdd")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-font-match-internal
|
|
|
|
(display screen-number pattern)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftFontMatch")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-font-open-pattern-internal
|
|
|
|
(display pattern)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftFontOpenPattern")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-font-open-name-internal
|
2003-10-17 04:38:24 -04:00
|
|
|
(display screen-number name)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftFontOpenName")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-font-open-xlfd-internal
|
2003-10-17 04:38:24 -04:00
|
|
|
(display screen-number xlfd-name)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftFontOpenXlfd")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-font-close-internal
|
|
|
|
(display font)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftFontClose")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-draw-create-internal
|
2003-10-13 11:27:19 -04:00
|
|
|
(display drawable visual colormap)
|
|
|
|
"scx_XftDrawCreate")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-draw-create-bitmap-internal
|
2003-10-13 11:27:19 -04:00
|
|
|
(display drawable)
|
|
|
|
"scx_XftDrawCreateBitmap")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-draw-change
|
|
|
|
(draw drawable)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftDrawChange")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-draw-display-internal
|
|
|
|
(draw)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftDrawDisplay")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-draw-drawable-internal
|
|
|
|
(draw)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftDrawDrawable")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-draw-colormap-internal
|
|
|
|
(draw)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftDrawColormap")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-draw-visual-internal
|
|
|
|
(draw)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftDrawVisual")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-draw-destroy
|
|
|
|
(draw)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftDrawDestroy")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-text-extents-8bit
|
|
|
|
(display font string)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftTextExtents8")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-draw-string-8bit
|
|
|
|
(draw color font x y string)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftDrawString8")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-draw-rect
|
|
|
|
(draw color x y w h)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftDrawRect")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-draw-set-clip
|
|
|
|
(draw region)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftDrawSetClip")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-objectset-create
|
2003-10-13 11:27:19 -04:00
|
|
|
()
|
|
|
|
"scx_XftObjectSetCreate")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-objectset-destroy
|
|
|
|
(objectset)
|
2003-10-16 12:05:03 -04:00
|
|
|
"scx_XftObjectSetDestroy")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-objectset-add-internal
|
|
|
|
(objectset object)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftObjectSetAdd")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-list-fonts-pattern-objects-internal
|
|
|
|
(display screen-number pattern objectset)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftListFontsPatternObjects")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-fontset-destroy
|
|
|
|
(fontset)
|
2003-10-17 04:38:24 -04:00
|
|
|
"scx_XftFontSetDestroy")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-color-alloc-name-internal
|
2003-10-17 04:38:24 -04:00
|
|
|
(display visual colormap name)
|
|
|
|
"scx_XftColorAllocName")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-color-alloc-value-internal
|
2003-10-23 13:18:55 -04:00
|
|
|
(display visual colormap xrendercolor)
|
|
|
|
"scx_XftColorAllocValue")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-color-free
|
|
|
|
(display visual colormap color)
|
2003-10-17 04:38:24 -04:00
|
|
|
"scx_XftColorFree")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-pattern-print
|
|
|
|
(pattern)
|
2003-10-17 04:38:24 -04:00
|
|
|
"scx_XftPatternPrint")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-default-has-render?
|
2003-10-17 04:38:24 -04:00
|
|
|
(display)
|
|
|
|
"scx_XftDefaultHasRender")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-default-substitute-internal
|
2003-10-26 14:00:42 -05:00
|
|
|
(display screen-number pattern)
|
|
|
|
"scx_XftDefaultSubstitute")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-font-ascent
|
|
|
|
(font)
|
2003-10-26 11:42:31 -05:00
|
|
|
"scx_xftfont_ascent_get")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-font-descent
|
|
|
|
(font)
|
2003-10-26 11:42:31 -05:00
|
|
|
"scx_xftfont_descent_get")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-font-height
|
|
|
|
(font)
|
2003-10-26 11:42:31 -05:00
|
|
|
"scx_xftfont_height_get")
|
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-font-max-advance-width
|
|
|
|
(font)
|
2003-10-26 11:42:31 -05:00
|
|
|
"scx_xftfont_max_advance_width_get")
|
2003-10-26 14:00:42 -05:00
|
|
|
|
2003-10-27 05:06:25 -05:00
|
|
|
(import-lambda-definition xft-fontset-count
|
|
|
|
(fontset)
|
2003-10-26 14:00:42 -05:00
|
|
|
"scx_xftfontset_count_get")
|
|
|
|
|
2004-04-27 12:15:19 -04:00
|
|
|
(import-lambda-definition xft-fontset-ref
|
2003-10-27 05:06:25 -05:00
|
|
|
(fontset index)
|
2003-10-26 14:00:42 -05:00
|
|
|
"scx_xftfontset_pattern_ref")
|