Re: [Haskell-cafe] Haskell SVG path parser?

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 ;)

Tillmann,
OK, I see: your code parses the "glyph" element which contains the
same kind of path definition that the "path" element does.
I think your code would be helpful for me as well.
And I think I'll use the same "xml" package to read in the SVG file (I
was thinking about this package earlier, and your code has a good
example of using it).
Thank you.
On Mon, May 24, 2010 at 12:20 PM, Tillmann Vogt
[skip]
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)?
-- Dimitry Golubovsky
Anywhere on the Web
participants (2)
-
Dimitry Golubovsky
-
Tillmann Vogt