[Haskell-cafe] Haskell SVG path parser?

Tillmann Vogt Tillmann.Vogt at rwth-aachen.de
Mon May 24 12:20:12 EDT 2010


Am 24.05.2010 14:21, schrieb Dimitry Golubovsky:
> Hi,
>
> Does there exist any Haskell package/library to parse the syntax of
> SVG elements, esp. PATH?

Hi Dimitry,

If you search on hackage for svg, you find my library SVGFonts. I first 
thought SVGFont is a special syntax similar to SVG, but it seems to be a 
subset of SVG. In my opinion it would be OK to split the SVG part out 
into a new library. I have made some improvements to SVGFonts which I 
haven't uploaded (i.e. points from bezier curves lying in a raster of a 
certain resolution). From a short look at Hennings code I guess my code 
may be little bit more beginner style, but parsing of the d attribute is 
implemeted more fully. I have spent quite some time on a tricky function 
"commandsToPoints" in ReadFont.hs which is about parsing the d field and 
translating it into outline points. Are you looking for something like that?

>
> That is, the syntax of the "d" attribute (e. g. M 100 100 L 300 100 L
> 200 300 z)?
>
> Hackage doesn't seem to have any, and Google search yields very broad results.
>
> Thanks.
>
> PS It should not be hard to write such parser, I just don't want to
> reivent the wheel ;)




More information about the Haskell-Cafe mailing list