How to get glyph outline from ttf font.

Greetings. I'm trying to render some glyphs from ttf font to svg image using gtk2hs cairo binding. Since I can find nothing appropriate in gtk2hs API, I decided to draw outlines with bezier curves myself. But how to get them out of font? As far as I know, freetype library is capable of extracting outlines, but is there any haskell binding for it which supports this functionality? Here [1] one such lib was mentioned, but it wasn't availible online that time. Have situation changed today? Thanks in advance [1] http://www.nabble.com/Re%3A-Rendering-TTF-fonts-in-Haskell-and-OpenGL-p15635...

Yes, the FTGL library, but it uses FTGL on the backend and not
freetype directly. You might be able to get the flyph shapes from
Pango...
On Sat, Apr 4, 2009 at 12:59 PM, Dmitry V'yal
Greetings. I'm trying to render some glyphs from ttf font to svg image using gtk2hs cairo binding. Since I can find nothing appropriate in gtk2hs API, I decided to draw outlines with bezier curves myself. But how to get them out of font? As far as I know, freetype library is capable of extracting outlines, but is there any haskell binding for it which supports this functionality?
Here [1] one such lib was mentioned, but it wasn't availible online that time. Have situation changed today?
Thanks in advance
[1] http://www.nabble.com/Re%3A-Rendering-TTF-fonts-in-Haskell-and-OpenGL-p15635... _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

A Haskell binding to Freetype2 is indeed missing. Would be nice to have.
On Sat, Apr 4, 2009 at 4:08 PM, Jeff Heard
Yes, the FTGL library, but it uses FTGL on the backend and not freetype directly. You might be able to get the flyph shapes from Pango...
On Sat, Apr 4, 2009 at 12:59 PM, Dmitry V'yal
wrote: Greetings. I'm trying to render some glyphs from ttf font to svg image using gtk2hs cairo binding. Since I can find nothing appropriate in gtk2hs API, I decided to draw outlines with bezier curves myself. But
how
to get them out of font? As far as I know, freetype library is capable of extracting outlines, but is there any haskell binding for it which supports this functionality?
Here [1] one such lib was mentioned, but it wasn't availible online that time. Have situation changed today?
Thanks in advance
[1]
http://www.nabble.com/Re%3A-Rendering-TTF-fonts-in-Haskell-and-OpenGL-p15635...
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Sat, Apr 4, 2009 at 6:59 PM, Dmitry V'yal
to get them out of font? As far as I know, freetype library is capable of extracting outlines, but is there any haskell binding for it which supports this functionality?
Here [1] one such lib was mentioned, but it wasn't availible online that time. Have situation changed today?
Hello, I am Bit from the thread that you referenced. I have not yet uploaded the bindings to FreeType that I mentioned. I'll try to upload a darcs repository of what I have. The bindings are incomplete, but there is full support for loading fonts and extracting the outlines. What is missing is FreeType's functions for rendering glyphs to bitmaps. I even made a high level wrapper function to make extraction of glyph outlines easier: outlineDecompose2 :: FT.Outline -> IO OutlineDecomposition data OutlineContourStep = OutlineContourLineTo FT.Vector | OutlineContourConicTo FT.Vector FT.Vector | OutlineContourCubicTo FT.Vector FT.Vector FT.Vector deriving (Eq, Show) data OutlineContour = OutlineContour FT.Vector [OutlineContourStep] deriving (Eq, Show) data OutlineDecomposition = OutlineDecomposition [OutlineContour] deriving (Eq, Show) I also made an example that renders the outlines using OpenGL to verify that everything works. I will apply for an account on code.haskell.org and upload the current state of the bindings into a darcs repository there. P.S. Anyone know how to apply to get an account on code.haskell.org?
participants (4)
-
Bit Connor
-
Dmitry V'yal
-
Jeff Heard
-
Peter Verswyvelen