Well, Achim you were almost exactly correct. I have a functional function interface in about half an hour's worth of work. I have one question, which is how to create a Ptr to four CFloats on the fly, pass them to the bounding box functions, and then come back out with a [Float]<br>
<br>My prototype looks like this:<br>foreign import ccall unsafe "ftglGetFontBBox" fgetFontBBox :: Font -> CString -> Ptr CFloat -> IO ()<br><br>the ptr to cfloat should be a float[4], which is modified inside the original C function.<br>
<br><div class="gmail_quote">On Fri, Jun 20, 2008 at 1:16 AM, Achim Schneider <<a href="mailto:barsoap@web.de">barsoap@web.de</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">"Jefferson Heard" <<a href="mailto:jefferson.r.heard@gmail.com">jefferson.r.heard@gmail.com</a>> wrote:<br>
<br>
> I've been looking for awhile now for a simple way to get truetype<br>
> fonts into my visualizations so I can abandon the hideous GLUT fonts<br>
> and make things that look like they were developed in the 1990s<br>
> instead of back in the days of TRON. I found FTGL, but I'm mostly a<br>
> Haskell developer these days, and resent having to go back to C just<br>
> to write a simple application.<br>
><br>
> So I was wondering if anyone had ever wrapped the FTGL library in<br>
> Haskel FFI or whether those out there who are experts on the FFI<br>
> think at first glance it should be readily wrappable by a rank<br>
> amateur at FFI such as myself.<br>
><br>
> <a href="http://ftgl.sourceforge.net/docs/html/" target="_blank">http://ftgl.sourceforge.net/docs/html/</a><br>
><br>
</div></div>Using the FFI is generally straight forward, as long as you can live<br>
with using the IO monad and the C code uses objects (well,<br>
pointers to structs passed as first argument, where's the<br>
difference...).<br>
<br>
Things only depend on the purity of the C code and how high-level you<br>
want your interface to be. In this case, I estimate half an hour if<br>
you're a fast typist. That includes the time needed to read the FFI<br>
docs.<br>
<br>
--<br>
(c) this sig last receiving data processing entity. Inspect headers for<br>
past copyright information. All rights reserved. Unauthorised copying,<br>
hiring, renting, public performance and/or broadcasting of this<br>
signature prohibited.<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>I try to take things like a crow; war and chaos don't always ruin a picnic, they just mean you have to be careful what you swallow.<br><br>-- Jessica Edwards