From: William Rutiser on
Rick DeNatale wrote:
> On Fri, Jul 30, 2010 at 2:11 PM, William Rutiser <wruyahoo05(a)comcast.net> wrote:
>
>> Rick DeNatale wrote:
>>
>>> I've recently started playing with an Epilog laser cutter, and I find
>>> myself wanting to programmatically generate SVG files.
>>>
>>> I googled for ruby and svg this morning and although there seem to be
>>> a few old stagnant efforts, there's nothing too useful I could find.
>>>
>>> I suppose it wouldn't be too hard to start cooking something up using
>>> Jim Wierich's xml builder gem, but before I got started I wanted to
>>> see if there was anything I missed.
>>>
>> Topher Cyll's book, "Practical Ruby Projects; Ideas for the Eclectic
>> Programmer", has a chapter that generates animations with SVG.
>> SVG is wrapped in an SVGObject class but it is only developed to the extent
>> needed for the example project. It may give you a start.
>>
>> See http://www.cyll.org/
>>
>
> I've been thinking about this a bit more, and for my purposes, which
> is having an api to describe a static vector graphic for use with
> things like laser cutters and other cam-like stuff with takes svg
> input, that it might be interesting to try to use the same API as
> Prawn for generating the graphics object model.
>
> The graphics models for pdf and svg seem to be quite similar, not
> surprising given Adobe's major input to SVG. I tend to see both as a
> declarative expression of the Postscript drawing model, or at least
> starting there.
>
> I notice that there's at least one Prawn svg 'renderer' out there, but
> it goes in the opposite direction I'm pursuing in that it renders svg
> into prawn calls, rather than generating SVG from the prawn document
> model.
>
> I haven't investigated any of this really deeply, but it may be
> possible to write something which extends and reuses most of Prawn but
> with a different class of Document and some associated classes which
> render SVG rather than PDF.
>
> Perhaps Gregory Brown or one of the other core Prawn contributors will
> see this and comment?
>
I am also interested in generating vector graphics with Ruby. One thing
I have peeked into is Cairo which advertises Ruby bindings. Cairo itself
seems to be widely used and is intended to support multiple back ends
including SVG.

Cairo is used by Shoes and Gnome. The Ruby bindings are called rcairo
but the api docs are mostly in Japanese.

-- Bill