1 ;;;; cl-ftgl -- FTGL binding for CL. See README for licensing information.
5 (define-foreign-library ftgl
6 (:unix
(:or
"libftgl" "libftgl.so.2"))
7 (t (:default
"libftgl")))
8 (use-foreign-library ftgl
)
10 (defctype font
:pointer
)
11 (defctype glyph
:pointer
)
12 (defctype layout
:pointer
)
15 (:unicode
#x756e6963
) ; unic
16 (:adobe-latin-1
#x6c617431
)) ; lat1
22 (defcenum text-alignment
28 (define-foreign-type pathname-string-type
()
30 (:actual-type
:string
)
31 (:simple-parser pathname-string
))
32 (eval-when (:compile-toplevel
:load-toplevel
)
33 (defmethod expand-to-foreign-dyn (value var body
(type pathname-string-type
))
34 `(with-foreign-string (,var
(if (pathnamep ,value
) (namestring ,value
) ,value
))
37 (defcfun ("ftglCreateCustomFont" create-custom-font
) font
"Create a custom FTGL font object."
38 (font-file-path pathname-string
) (data :pointer
) (make-glyph-callback :pointer
))
39 (defcfun ("ftglDestroyFont" destroy-font
) :void
"Destroy an FTGL font object." (font font
))
40 (defcfun ("ftglAttachFile" attach-file
) :int
"Attach auxilliary file to font e.g." (font font
) (path pathname-string
))
41 ;; XXX size is actually size_t
42 (defcfun ("ftglAttachData" attach-data
) :int
"Attach auxilliary data to font, e.g." (font font
) (data (:pointer
:uint8
)) (size :int
))
43 (defcfun ("ftglSetFontCharMap" set-font-char-map
) :int
"Set the character map for the face." (font font
) (encoding encoding
))
44 (defcfun ("ftglGetFontCharMapCount" get-font-char-map-count
) :unsigned-int
"Get the number of character maps in this face." (font font
))
45 (defcfun ("ftglGetFontCharMapList" get-font-char-map-list
) encoding
"Get a list of character maps in this face." (font font
))
46 (defcfun ("ftglSetFontFaceSize" set-font-face-size
) :int
"Set the char size for the current face." (font font
) (size :unsigned-int
) (res :unsigned-int
))
47 (defcfun ("ftglGetFontFaceSize" get-font-face-size
) :unsigned-int
"Get the current face size in points (1/72 inch)." (font font
))
48 (defcfun ("ftglSetFontDepth" set-font-depth
) :void
"Set the extrusion distance for the font." (font font
) (depth :float
))
49 (defcfun ("ftglSetFontOutset" set-font-outset
) :void
"Set the outset distance for the font." (font font
) (front :float
) (back :float
))
50 (defcfun ("ftglSetFontDisplayList" set-font-display-list
) :void
"Enable or disable the use of Display Lists inside FTGL." (font font
) (use-list :boolean
))
51 (defcfun ("ftglGetFontAscender" get-font-ascender
) :float
"Get the global ascender height for the face." (font font
))
52 (defcfun ("ftglGetFontDescender" get-font-descender
) :float
"Gets the global descender height for the face." (font font
))
53 (defcfun ("ftglGetFontLineHeight" get-font-line-height
) :float
"Gets the line spacing for the font." (font font
))
54 (defcfun ("ftglGetFontBBox" %get-font-bbox
) :void
"Get the bounding box for a string." (font font
) (string :string
) (len :int
) (bounds (:pointer
:float
)))
55 (defcfun ("ftglGetFontAdvance" get-font-advance
) :float
"Get the advance width for a string." (font font
) (string :string
))
56 (defcfun ("ftglRenderFont" render-font
) :void
"Render a string of characters." (font font
) (string :string
) (mode render-mode
))
57 (defcfun ("ftglGetFontError" get-font-error
) :int
"Query a font for errors." (font font
))
59 (defcfun ("ftglCreatePixmapFont" create-pixmap-font
) font
"Create a specialised FTGLfont object for handling pixmap (grey scale) fonts." (file pathname-string
))
60 (defcfun ("ftglCreatePolygonFont" create-polygon-font
) font
"Create a specialised FTGLfont object for handling tesselated polygon mesh fonts." (file pathname-string
))
61 (defcfun ("ftglCreateOutlineFont" create-outline-font
) font
"Create a specialised FTGLfont object for handling vector outline fonts." (file pathname-string
))
62 (defcfun ("ftglCreateExtrudeFont" create-extrude-font
) font
"Create a specialised FTGLfont object for handling extruded poygon fonts." (file pathname-string
))
63 (defcfun ("ftglCreateTextureFont" create-texture-font
) font
"Create a specialised FTGLfont object for handling texture-mapped fonts." (file pathname-string
))
64 (defcfun ("ftglCreateBufferFont" create-buffer-font
) font
"Create a specialised FTGLfont object for handling buffered fonts." (file pathname-string
))
66 (defcfun ("ftglCreateCustomGlyph" create-custom-glyph
) glyph
"Create a custom FTGL glyph object." (base glyph
) (data :pointer
) (render-callback :pointer
) (destroy-callback :pointer
))
67 (defcfun ("ftglDestroyGlyph" destroy-glyph
) :void
"Destroy an FTGL glyph object." (glyph glyph
))
68 (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
)))
69 (defcfun ("ftglGetGlyphAdvance" get-glyph-advance
) :float
"Return the advance for a glyph." (glyph glyph
))
70 (defcfun ("ftglGetGlyphBBox" get-glyph-bbox
) :void
"Return the bounding box for a glyph." (glyph glyph
) (bounds (:pointer
:float
)))
71 (defcfun ("ftglGetGlyphError" get-glyph-error
) :int
"Query a glyph for errors." (glyph glyph
))
73 (defcfun ("ftglDestroyLayout" destroy-layout
) :void
"Destroy an FTGL layout object." (layout layout
))
74 ;;(defcfun ("ftglGetLayoutBBox" get-layout-bbox) :void "Get the bounding box for a string." (layout layout) (string :string) (bounds (:pointer :float)))
75 (defcfun ("ftglRenderLayout" render-layout
) :void
"Render a string of characters." (layout layout
) (string :string
) (mode render-mode
))
76 (defcfun ("ftglGetLayoutError" get-layout-error
) :int
"Query a layout for errors." (layout layout
))