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
|
|
|
|
(make-xft-font x-pointer)
|
|
|
|
xft-font?
|
|
|
|
(x-pointer xft-font-x-pointer))
|
|
|
|
|
|
|
|
(define-exported-binding "xft-font" :xft-font)
|
|
|
|
|
|
|
|
(define-record-type xft-draw :xft-draw
|
|
|
|
(make-xft-draw 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-17 04:38:24 -04:00
|
|
|
(make-xft-color 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
|
2003-10-17 04:38:24 -04:00
|
|
|
(really-make-xft-fontset c-pointer patterns)
|
2003-10-13 11:27:19 -04:00
|
|
|
xft-fontset?
|
2003-10-17 04:38:24 -04:00
|
|
|
(c-pointer xft-fontset-c-pointer)
|
|
|
|
(patterns xft-fontset-patterns set-xft-fontset-patterns!))
|
2003-10-13 11:27:19 -04:00
|
|
|
|
|
|
|
(define-exported-binding "xft-fontset" :xft-fontset)
|
|
|
|
|
|
|
|
;;; add finalizers
|
|
|
|
|
|
|
|
(define (make-xft-pattern)
|
|
|
|
(let ((xft-pattern (scx-xft-pattern-create)))
|
|
|
|
(add-finalizer! xft-pattern scx-xft-pattern-destroy)
|
|
|
|
xft-pattern))
|
|
|
|
|
|
|
|
(define (scx-xft-pattern-duplicate xft-pattern)
|
|
|
|
(let ((copy (scx-xft-pattern-duplicate-internal xft-pattern)))
|
|
|
|
(add-finalizer! copy scx-xft-pattern-destroy)
|
|
|
|
copy))
|
|
|
|
|
|
|
|
(define (scx-xft-font-match display screen xft-pattern)
|
|
|
|
(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)))
|
|
|
|
(scx-xft-font-match-internal display screen-number xft-pattern)))
|
2003-10-13 11:27:19 -04:00
|
|
|
(lambda (result xft-pattern)
|
|
|
|
(add-finalizer! xft-pattern scx-xft-pattern-destroy)
|
2003-10-16 12:05:03 -04:00
|
|
|
(values result xft-pattern))))
|
2003-10-13 11:27:19 -04:00
|
|
|
|
|
|
|
(define (scx-xft-font-open-pattern display xft-pattern)
|
|
|
|
(let ((xft-font (scx-xft-font-open-pattern-internal display xft-pattern)))
|
2003-10-14 11:27:33 -04:00
|
|
|
(add-finalizer! xft-font scx-xft-font-close)
|
2003-10-13 11:27:19 -04:00
|
|
|
xft-font))
|
|
|
|
|
|
|
|
(define (scx-xft-font-open-name display screen name)
|
2003-10-17 04:38:24 -04:00
|
|
|
(let* ((screen-number (screen:number screen))
|
|
|
|
(xft-font (scx-xft-font-open-name-internal display screen-number name)))
|
2003-10-14 11:27:33 -04:00
|
|
|
(add-finalizer! xft-font scx-xft-font-close)
|
2003-10-13 11:27:19 -04:00
|
|
|
xft-font))
|
|
|
|
|
|
|
|
(define (scx-xft-font-open-xlfd display screen name)
|
2003-10-17 04:38:24 -04:00
|
|
|
(let* ((screen-numer (screen:number screen))
|
|
|
|
(xft-font (scx-xft-font-open-xlfd-internal display screen-numer name)))
|
2003-10-14 11:27:33 -04:00
|
|
|
(add-finalizer! xft-font scx-xft-font-close)
|
2003-10-13 11:27:19 -04:00
|
|
|
xft-font))
|
|
|
|
|
|
|
|
(define (scx-xft-draw-create display drawable visual colormap)
|
|
|
|
(let ((xft-draw (scx-xft-draw-create-internal display drawable visual colormap)))
|
|
|
|
(add-finalizer! xft-draw scx-xft-draw-destroy)
|
|
|
|
xft-draw))
|
|
|
|
|
|
|
|
(define (scx-xft-draw-create-bitmap display drawable)
|
|
|
|
(let ((xft-draw (scx-xft-draw-create-bitmap-internal display drawable)))
|
|
|
|
(add-finalizer! xft-draw scx-xft-draw-destroy)
|
|
|
|
xft-draw))
|
|
|
|
|
|
|
|
(define (make-xft-objectset)
|
|
|
|
(let ((xft-objectset (scx-xft-objectset-create)))
|
|
|
|
(add-finalizer! xft-objectset scx-xft-objectset-destroy)
|
|
|
|
xft-objectset))
|
|
|
|
|
2003-10-14 11:27:33 -04:00
|
|
|
(define (scx-xft-draw-display xft-draw)
|
|
|
|
(let ((display (scx-xft-draw-display-internal xft-draw)))
|
|
|
|
(if display
|
|
|
|
display
|
|
|
|
(error "XftDrawDisplay() unavailable in this version of Xft"))))
|
|
|
|
|
|
|
|
(define (scx-xft-draw-drawable xft-draw)
|
|
|
|
(let ((drawable (scx-xft-draw-drawable-internal xft-draw)))
|
|
|
|
(if drawable
|
|
|
|
drawable
|
|
|
|
(error "XftDrawDrawable() unavailable in this version of Xft"))))
|
|
|
|
|
|
|
|
(define (scx-xft-draw-colormap xft-draw)
|
|
|
|
(let ((colormap (scx-xft-draw-colormap-internal xft-draw)))
|
|
|
|
(if colormap
|
|
|
|
colormap
|
|
|
|
(error "XftDrawColormap() unavailable in this version of Xft"))))
|
|
|
|
|
|
|
|
(define (scx-xft-draw-visual xft-draw)
|
|
|
|
(let ((visual (scx-xft-draw-visual-internal xft-draw)))
|
|
|
|
(if visual
|
|
|
|
visual
|
|
|
|
(error "XftDrawVisual() unavailable in this version of Xft"))))
|
|
|
|
|
2003-10-17 04:38:24 -04:00
|
|
|
(define (scx-xft-list-fonts-pattern-objects display screen xft-pattern xft-objectset)
|
|
|
|
(let* ((screen-number (screen:number screen))
|
|
|
|
(fontset (scx-xft-list-fonts-pattern-objects-internal
|
|
|
|
display screen-number xft-pattern xft-objectset)))
|
|
|
|
(add-finalizer! fontset scx-xft-fontset-destroy)
|
|
|
|
fontset))
|
|
|
|
|
|
|
|
(define (make-xft-fontset)
|
|
|
|
(let ((fontset (scx-xft-fontset-create)))
|
|
|
|
(set-xft-fontset-patterns! fontset '())
|
|
|
|
(add-finalizer! fontset scx-xft-fontset-create)
|
|
|
|
fontset))
|
|
|
|
|
|
|
|
(define (scx-xft-fontset-add xft-fontset xft-pattern)
|
|
|
|
(set-xft-fontset-patterns!
|
|
|
|
xft-fontset (lset-adjoin eq? xft-pattern (xft-fontset-patterns xft-fontset)))
|
|
|
|
(scx-xft-fontset-add-internal xft-fontset xft-pattern))
|
|
|
|
|
|
|
|
(define (scx-xft-color-alloc-name display visual colormap name)
|
2003-10-23 13:18:55 -04:00
|
|
|
(call-with-values
|
|
|
|
(lambda ()
|
|
|
|
(apply values
|
|
|
|
(scx-xft-color-alloc-name-internal display visual colormap name)))
|
|
|
|
(lambda (success? xft-color)
|
|
|
|
(if success?
|
|
|
|
(begin
|
|
|
|
(set-xft-color-display! xft-color display)
|
|
|
|
(set-xft-color-visual! xft-color visual)
|
|
|
|
(set-xft-color-colormap! xft-color colormap)
|
|
|
|
(add-finalizer! xft-color xft-color-finalizer)
|
|
|
|
xft-color)
|
|
|
|
;;; FIXME: raise error
|
|
|
|
#f))))
|
|
|
|
|
|
|
|
(define (scx-xft-color-alloc-value display visual colormap xrendercolor)
|
|
|
|
(let ((xft-color (scx-xft-color-alloc-value-internal display visual colormap xrendercolor)))
|
2003-10-17 04:38:24 -04:00
|
|
|
(set-xft-color-display! xft-color display)
|
|
|
|
(set-xft-color-visual! xft-color visual)
|
|
|
|
(set-xft-color-colormap! xft-color colormap)
|
|
|
|
(add-finalizer! xft-color xft-color-finalizer)
|
|
|
|
xft-color))
|
|
|
|
|
|
|
|
(define (xft-color-finalizer xft-color)
|
|
|
|
(scx-xft-color-free (xft-color-display xft-color)
|
|
|
|
(xft-color-visual xft-color)
|
|
|
|
(xft-color-colormap xft-color)
|
|
|
|
xft-color))
|
|
|
|
|
2003-10-16 12:05:03 -04:00
|
|
|
;;; import values from C code
|
|
|
|
(define scx-xft-version-major
|
|
|
|
(shared-binding-ref
|
|
|
|
(lookup-imported-binding "scx-xft-version-major")))
|
|
|
|
|
|
|
|
(define scx-xft-version-minor
|
|
|
|
(shared-binding-ref
|
|
|
|
(lookup-imported-binding "scx-xft-version-minor")))
|
|
|
|
|
|
|
|
(define scx-xft-result-match
|
|
|
|
(shared-binding-ref
|
|
|
|
(lookup-imported-binding "scx-xft-result-match")))
|
|
|
|
|
|
|
|
(define scx-xft-result-no-match
|
|
|
|
(shared-binding-ref
|
|
|
|
(lookup-imported-binding "scx-xft-result-no-match")))
|
|
|
|
|
|
|
|
(define scx-xft-result-type-mismatch
|
|
|
|
(shared-binding-ref
|
|
|
|
(lookup-imported-binding "scx-xft-result-type-mismatch")))
|
|
|
|
|
|
|
|
(define scx-xft-result-no-id
|
|
|
|
(shared-binding-ref
|
|
|
|
(lookup-imported-binding "scx-xft-result-no-id")))
|
|
|
|
|
2003-10-13 11:27:19 -04:00
|
|
|
;;; import functions from C code
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-pattern-create
|
|
|
|
()
|
|
|
|
"scx_XftPatternCreate")
|
|
|
|
|
2003-10-16 12:05:03 -04:00
|
|
|
(import-lambda-definition scx-xft-pattern-destroy
|
|
|
|
()
|
|
|
|
"scx_XftPatternDestroy")
|
|
|
|
|
2003-10-13 11:27:19 -04:00
|
|
|
(import-lambda-definition scx-xft-pattern-duplicate-internal
|
|
|
|
(xft-pattern)
|
|
|
|
"scx_XftPatternDuplicate")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-pattern-get
|
|
|
|
(xft-pattern object id)
|
|
|
|
"scx_XftPatternGet")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-pattern-add
|
|
|
|
(xft-pattern object value append?)
|
|
|
|
"scx_XftPatternAdd")
|
|
|
|
|
2003-10-14 11:27:33 -04:00
|
|
|
(import-lambda-definition scx-xft-font-match-internal
|
2003-10-17 04:38:24 -04:00
|
|
|
(display screen-number xft-pattern)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftFontMatch")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-font-open-pattern-internal
|
|
|
|
(display xft-pattern)
|
|
|
|
"scx_XftFontOpenPattern")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-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")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-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")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-font-close
|
|
|
|
(display xft-font)
|
|
|
|
"scx_XftFontClose")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-draw-create-internal
|
|
|
|
(display drawable visual colormap)
|
|
|
|
"scx_XftDrawCreate")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-draw-create-bitmap-internal
|
|
|
|
(display drawable)
|
|
|
|
"scx_XftDrawCreateBitmap")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-draw-change
|
|
|
|
(xft-draw drawable)
|
|
|
|
"scx_XftDrawChange")
|
|
|
|
|
2003-10-14 11:27:33 -04:00
|
|
|
(import-lambda-definition scx-xft-draw-display-internal
|
2003-10-13 11:27:19 -04:00
|
|
|
(xft-draw)
|
|
|
|
"scx_XftDrawDisplay")
|
|
|
|
|
2003-10-14 11:27:33 -04:00
|
|
|
(import-lambda-definition scx-xft-draw-drawable-internal
|
2003-10-13 11:27:19 -04:00
|
|
|
(xft-draw)
|
|
|
|
"scx_XftDrawDrawable")
|
|
|
|
|
2003-10-14 11:27:33 -04:00
|
|
|
(import-lambda-definition scx-xft-draw-colormap-internal
|
2003-10-13 11:27:19 -04:00
|
|
|
(xft-draw)
|
|
|
|
"scx_XftDrawColormap")
|
|
|
|
|
2003-10-14 11:27:33 -04:00
|
|
|
(import-lambda-definition scx-xft-draw-visual-internal
|
2003-10-13 11:27:19 -04:00
|
|
|
(xft-draw)
|
|
|
|
"scx_XftDrawVisual")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-draw-destroy
|
|
|
|
(xft-draw)
|
|
|
|
"scx_XftDrawDestroy")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-text-extents-8bit
|
|
|
|
(display xft-font string)
|
|
|
|
"scx_XftTextExtents8")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-draw-string-8bit
|
|
|
|
(xft-draw xft-color xft-font x y string)
|
|
|
|
"scx_XftDrawString8")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-draw-rect
|
|
|
|
(xft-draw xft-color x y w h)
|
|
|
|
"scx_XftDrawRect")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-draw-set-clip
|
|
|
|
(xft-draw region)
|
|
|
|
"scx_XftDrawSetClip")
|
|
|
|
|
2003-10-14 11:27:33 -04:00
|
|
|
(import-lambda-definition scx-xft-objectset-create
|
2003-10-13 11:27:19 -04:00
|
|
|
()
|
|
|
|
"scx_XftObjectSetCreate")
|
|
|
|
|
2003-10-16 12:05:03 -04:00
|
|
|
(import-lambda-definition scx-xft-objectset-destroy
|
|
|
|
(xft-objectset)
|
|
|
|
"scx_XftObjectSetDestroy")
|
|
|
|
|
2003-10-14 11:27:33 -04:00
|
|
|
(import-lambda-definition scx-xft-objectset-add
|
2003-10-13 11:27:19 -04:00
|
|
|
(xft-objectset object)
|
|
|
|
"scx_XftObjectSetAdd")
|
|
|
|
|
2003-10-17 04:38:24 -04:00
|
|
|
(import-lambda-definition scx-xft-list-fonts-pattern-objects-internal
|
|
|
|
(display screen-number xft-pattern xft-objectset)
|
2003-10-13 11:27:19 -04:00
|
|
|
"scx_XftListFontsPatternObjects")
|
|
|
|
|
2003-10-17 04:38:24 -04:00
|
|
|
(import-lambda-definition scx-xft-fontset-create
|
|
|
|
()
|
|
|
|
"scx_XftFontSetCreate")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-fontset-destroy
|
|
|
|
(xft-fontset)
|
|
|
|
"scx_XftFontSetDestroy")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-fontset-add-internal
|
|
|
|
(xft-fontset xft-pattern)
|
|
|
|
"scx_XftFontSetAdd")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-color-alloc-name-internal
|
|
|
|
(display visual colormap name)
|
|
|
|
"scx_XftColorAllocName")
|
|
|
|
|
2003-10-23 13:18:55 -04:00
|
|
|
(import-lambda-definition scx-xft-color-alloc-value-internal
|
|
|
|
(display visual colormap xrendercolor)
|
|
|
|
"scx_XftColorAllocValue")
|
|
|
|
|
2003-10-17 04:38:24 -04:00
|
|
|
(import-lambda-definition scx-xft-color-free
|
|
|
|
(display visual colormap xft-color)
|
|
|
|
"scx_XftColorFree")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-pattern-print
|
|
|
|
(xft-pattern)
|
|
|
|
"scx_XftPatternPrint")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-fontset-print
|
|
|
|
(xft-fontset)
|
|
|
|
"scx_XftFontSetPrint")
|
|
|
|
|
|
|
|
(import-lambda-definition scx-xft-default-has-render?
|
|
|
|
(display)
|
|
|
|
"scx_XftDefaultHasRender")
|
|
|
|
|