[Haskell-cafe] Re: Wrapping FTGL in FFI calls
jefferson.r.heard at gmail.com
Fri Jun 20 14:25:42 EDT 2008
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]
My prototype looks like this:
foreign import ccall unsafe "ftglGetFontBBox" fgetFontBBox :: Font ->
CString -> Ptr CFloat -> IO ()
the ptr to cfloat should be a float, which is modified inside the
original C function.
On Fri, Jun 20, 2008 at 1:16 AM, Achim Schneider <barsoap at web.de> wrote:
> "Jefferson Heard" <jefferson.r.heard at gmail.com> wrote:
> > I've been looking for awhile now for a simple way to get truetype
> > fonts into my visualizations so I can abandon the hideous GLUT fonts
> > and make things that look like they were developed in the 1990s
> > instead of back in the days of TRON. I found FTGL, but I'm mostly a
> > Haskell developer these days, and resent having to go back to C just
> > to write a simple application.
> > So I was wondering if anyone had ever wrapped the FTGL library in
> > Haskel FFI or whether those out there who are experts on the FFI
> > think at first glance it should be readily wrappable by a rank
> > amateur at FFI such as myself.
> > http://ftgl.sourceforge.net/docs/html/
> Using the FFI is generally straight forward, as long as you can live
> with using the IO monad and the C code uses objects (well,
> pointers to structs passed as first argument, where's the
> Things only depend on the purity of the C code and how high-level you
> want your interface to be. In this case, I estimate half an hour if
> you're a fast typist. That includes the time needed to read the FFI
> (c) this sig last receiving data processing entity. Inspect headers for
> past copyright information. All rights reserved. Unauthorised copying,
> hiring, renting, public performance and/or broadcasting of this
> signature prohibited.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
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.
-- Jessica Edwards
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe