summaryrefslogtreecommitdiff
path: root/2d
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@member.fsf.org>2013-08-18 08:00:28 -0400
committerDavid Thompson <dthompson@member.fsf.org>2013-08-18 08:00:28 -0400
commit40edffee940f8304b4f06640a060a2b3951c1506 (patch)
tree3f258d31bf026075a85c7a21fdc3fab2f9f09a60 /2d
parent688af31061f35e6f6085f5dacf59eb05dab851f6 (diff)
Add wrappers for FTGL simple layout objects.
Diffstat (limited to '2d')
-rw-r--r--2d/wrappers/ftgl.scm80
1 files changed, 80 insertions, 0 deletions
diff --git a/2d/wrappers/ftgl.scm b/2d/wrappers/ftgl.scm
index 6c94840..3108e8e 100644
--- a/2d/wrappers/ftgl.scm
+++ b/2d/wrappers/ftgl.scm
@@ -87,3 +87,83 @@
(export ftgl-create-texture-font
ftgl-set-font-face-size
ftgl-render-font)
+
+;;;
+;;; SimpleLayout
+;;;
+
+(define-wrapped-pointer-type <ftgl-simple-layout>
+ ftgl-simple-layout?
+ wrap-ftgl-simple-layout unwrap-ftgl-simple-layout
+ (lambda (r port)
+ (let ((simple-layout (unwrap-ftgl-simple-layout r)))
+ (format port
+ "<ftgl-simple-layout ~x>"
+ (pointer-address simple-layout)))))
+
+(define-foreign %ftgl-create-simple-layout
+ '* "ftglCreateSimpleLayout" '())
+
+(define-foreign %ftgl-set-layout-font
+ void "ftglSetLayoutFont" '(* *))
+
+(define-foreign %ftgl-get-layout-font
+ '* "ftglGetLayoutFont" '(*))
+
+(define-foreign %ftgl-set-layout-line-length
+ void "ftglSetLayoutLineLength" (list '* float))
+
+(define-foreign %ftgl-get-layout-line-length
+ float "ftglGetLayoutLineLength" '(*))
+
+(define-foreign %ftgl-set-layout-alignment
+ void "ftglSetLayoutAlignment" (list '* int))
+
+(define-foreign %ftgl-get-layout-alignment
+ int "ftglGetLayoutAlignement" '(*))
+
+(define-foreign %ftgl-set-layout-line-spacing
+ void "ftglSetLayoutLineSpacing" (list '* float))
+
+;; For some reason this symbol is not found.
+;; (define-foreign %ftgl-get-layout-line-spacing
+;; float "ftglGetLayoutLineSpacing" '(*))
+
+(define (ftgl-create-simple-layout)
+ (wrap-ftgl-simple-layout
+ (%ftgl-create-simple-layout)))
+
+(define (ftgl-set-layout-font layout font)
+ (%ftgl-set-layout-font (unwrap-ftgl-simple-layout layout)
+ (unwrap-ftgl-font font)))
+
+(define (ftgl-get-layout-font layout)
+ (wrap-ftgl-font
+ (%ftgl-get-layout-font (unwrap-ftgl-simple-layout layout))))
+
+(define (ftgl-set-layout-line-length layout line-length)
+ (%ftgl-set-layout-line-length (unwrap-ftgl-simple-layout layout)
+ line-length))
+
+(define (ftgl-get-layout-line-length layout)
+ (%ftgl-get-layout-line-length (unwrap-ftgl-simple-layout layout)))
+
+(define (ftgl-set-layout-alignment layout alignment)
+ (%ftgl-set-layout-alignment (unwrap-ftgl-simple-layout layout)
+ alignment))
+
+(define (ftgl-get-layout-alignment layout)
+ (%ftgl-get-layout-alignment (unwrap-ftgl-simple-layout layout)))
+
+(define (ftgl-set-layout-line-spacing layout spacing)
+ (%ftgl-set-layout-line-spacing (unwrap-ftgl-simple-layout layout)
+ spacing))
+
+(export ftgl-create-simple-layout
+ ftgl-set-layout-font
+ ftgl-get-layout-font
+ ftgl-set-layout-line-length
+ ftgl-get-layout-line-length
+ ftgl-set-layout-alignment
+ ftgl-get-layout-alignment
+ ftgl-set-layout-line-spacing)