Added FTGL for convenience
[cl-glfw.git] / lib / ftgl.lisp
blobdb04911b223575b03dcdb1a7030e0f73bb4fbf3d
1 (in-package :cl-glfw-ftgl)
3 (define-foreign-library ftgl
4 (:unix (:or "libftgl" "libftgl.so.2"))
5 (t (:default "libftgl")))
6 (use-foreign-library ftgl)
8 (defctype font :pointer)
9 (defctype glyph :pointer)
10 (defctype layout :pointer)
11 (defcenum encoding
12 (:none 0)
13 (:unicode #x756e6963) ; unic
14 (:adobe-latin-1 #x6c617431)) ; lat1
15 (defcenum render-mode
16 (:front 1)
17 (:back 2)
18 (:side 4)
19 (:all #xffff))
20 (defcenum text-alignment
21 (:left 0)
22 (:center 1)
23 (:right 2)
24 (:justify 3))
26 (defcfun ("ftglCreateCustomFont" create-custom-font) font "Create a custom FTGL font object."
27 (font-file-path :string) (data :pointer) (make-glyph-callback :pointer))
28 (defcfun ("ftglDestroyFont" destroy-font) :void "Destroy an FTGL font object." (font font))
29 (defcfun ("ftglAttachFile" attach-file) :int "Attach auxilliary file to font e.g." (font font) (path :string))
30 ;; XXX size is actually size_t
31 (defcfun ("ftglAttachData" attach-data) :int "Attach auxilliary data to font, e.g." (font font) (data (:pointer :uint8)) (size :int))
32 (defcfun ("ftglSetFontCharMap" set-font-char-map) :int "Set the character map for the face." (font font) (encoding encoding))
33 (defcfun ("ftglGetFontCharMapCount" get-font-char-map-count) :unsigned-int "Get the number of character maps in this face." (font font))
34 (defcfun ("ftglGetFontCharMapList" get-font-char-map-list) encoding "Get a list of character maps in this face." (font font))
35 (defcfun ("ftglSetFontFaceSize" set-font-face-size) :int "Set the char size for the current face." (font font) (size :unsigned-int) (res :unsigned-int))
36 (defcfun ("ftglGetFontFaceSize" get-font-face-size) :unsigned-int "Get the current face size in points (1/72 inch)." (font font))
37 (defcfun ("ftglSetFontDepth" set-font-depth) :void "Set the extrusion distance for the font." (font font) (depth :float))
38 (defcfun ("ftglSetFontOutset" set-font-outset) :void "Set the outset distance for the font." (font font) (front :float) (back :float))
39 (defcfun ("ftglSetFontDisplayList" set-font-display-list) :void "Enable or disable the use of Display Lists inside FTGL." (font font) (use-list :boolean))
40 (defcfun ("ftglGetFontAscender" get-font-ascender) :float "Get the global ascender height for the face." (font font))
41 (defcfun ("ftglGetFontDescender" get-font-descender) :float "Gets the global descender height for the face." (font font))
42 (defcfun ("ftglGetFontLineHeight" get-font-line-height) :float "Gets the line spacing for the font." (font font))
43 (defcfun ("ftglGetFontBBox" %get-font-bbox) :void "Get the bounding box for a string." (font font) (string :string) (len :int) (bounds (:pointer :float)))
44 (defcfun ("ftglGetFontAdvance" get-font-advance) :float "Get the advance width for a string." (font font) (string :string))
45 (defcfun ("ftglRenderFont" render-font) :void "Render a string of characters." (font font) (string :string) (mode render-mode))
46 (defcfun ("ftglGetFontError" get-font-error) :int "Query a font for errors." (font font))
48 (defcfun ("ftglCreatePixmapFont" create-pixmap-font) font "Create a specialised FTGLfont object for handling pixmap (grey scale) fonts." (file :string))
49 (defcfun ("ftglCreatePolygonFont" create-polygon-font) font "Create a specialised FTGLfont object for handling tesselated polygon mesh fonts." (file :string))
50 (defcfun ("ftglCreateOutlineFont" create-outline-font) font "Create a specialised FTGLfont object for handling vector outline fonts." (file :string))
51 (defcfun ("ftglCreateExtrudeFont" create-extrude-font) font "Create a specialised FTGLfont object for handling extruded poygon fonts." (file :string))
52 (defcfun ("ftglCreateTextureFont" create-texture-font) font "Create a specialised FTGLfont object for handling texture-mapped fonts." (file :string))
53 (defcfun ("ftglCreateBufferFont" create-buffer-font) font "Create a specialised FTGLfont object for handling buffered fonts." (file :string))
55 (defcfun ("ftglCreateCustomGlyph" create-custom-glyph) glyph "Create a custom FTGL glyph object." (base glyph) (data :pointer) (render-callback :pointer) (destroy-callback :pointer))
56 (defcfun ("ftglDestroyGlyph" destroy-glyph) :void "Destroy an FTGL glyph object." (glyph glyph))
57 (defcfun ("ftglRenderGlyph" render-glyph) :void "Render a glyph at the current pen position and compute the corresponding advance." (glyph glyph) (penx :double) (peny :double) (render-mode render-mode) (advance-x (:pointer :double)) (advance-y (:pointer :double)))
58 (defcfun ("ftglGetGlyphAdvance" get-glyph-advance) :float "Return the advance for a glyph." (glyph glyph))
59 (defcfun ("ftglGetGlyphBBox" get-glyph-bbox) :void "Return the bounding box for a glyph." (glyph glyph) (bounds (:pointer :float)))
60 (defcfun ("ftglGetGlyphError" get-glyph-error) :int "Query a glyph for errors." (glyph glyph))
62 (defcfun ("ftglDestroyLayout" destroy-layout) :void "Destroy an FTGL layout object." (layout layout))
63 ;;(defcfun ("ftglGetLayoutBBox" get-layout-bbox) :void "Get the bounding box for a string." (layout layout) (string :string) (bounds (:pointer :float)))
64 (defcfun ("ftglRenderLayout" render-layout) :void "Render a string of characters." (layout layout) (string :string) (mode render-mode))
65 (defcfun ("ftglGetLayoutError" get-layout-error) :int "Query a layout for errors." (layout layout))