SVG -> Cairo, Ubuntu way – ?

12:49 pm General

In gswitchit-plugins, I am rendering svg files into Cairo. Using libsvg-cairo. Some people were asking me, if I could make .deb of the plugins (for Ubuntu). No, I cannot – because libsvg-cairo is not packaged in Ubuntu. I wonder, what do Ubuntaries do when they have to render SVG to Cairo?

9 Responses

  1. Fabien Chaillou Says:

    Hello
    i’m no expert in it at all but i’m pretty sure that libsvg-cairo is obsoleted by librsvg which is available in ubuntu.

    Doesn’t cairo have a built-in backend for svg now?

  2. Stefan Stuhr Says:

    I suppose they use rsvg_handle_render_cairo. I have used it successfully with the librsvg Python bindings.

    /**
    * rsvg_handle_render_cairo
    * @handle: A RsvgHandle
    * @cr: A Cairo renderer
    *
    * Draws a SVG to a Cairo surface
    *
    * Since: 2.14
    */
    void
    rsvg_handle_render_cairo (RsvgHandle * handle, cairo_t * cr)

    http://svn.gnome.org/viewcvs/librsvg/trunk/rsvg-cairo-render.c?view=markup

  3. Dominic Lachowicz Says:

    librsvg renders via cairo. #include for details.

  4. Kyle McFarland Says:

    the newer versions of perhaps?

  5. Kyle McFarland Says:

    er, that should be rsvg rather.

  6. Sergey Udaltsov Says:

    Lads, thanks to all of you – I’ll try librsvg.

  7. Dominic Lachowicz Says:

    Fabian – yes, cairo has a SVG backend. But this only generates SVG content. It does not render SVG content.

  8. mail Says:

    Ubunteros, actually.

  9. Steve Lee Says:

    FYI some basic python bindings for librsvg come with pygtk (import rsvg). If you need access to more librsvg features (like draw from id) it looks like you’ll need to roll your own with ctypes.

    I was using pixbuff loader as a quick hack but have switched over to the cairo rendering now in Jambu.