[cairo] SVG backend patch - update

Jason Dorje Short jdorje at users.sf.net
Fri Sep 2 14:24:26 PDT 2005


Emmanuel Pacaud wrote:
> Le dimanche 07 août 2005 à 11:57 +0200, Emmanuel Pacaud a écrit :

>>Here's attached a more complete SVG backend, along with a cairo-demo
>>patch which provides a new cairo_snippets_svg utility.

> Really, no comments ? 
> 
> I'd like to make this patch commitable, and would really appreciate a
> review before continuing this work.

I had to manually resolve conflicts in cairoint.h.  Then...

cairo will be compiled with the following surface backends:
   Xlib:       yes
   Quartz:     no
   XCB:        no
   Win32:      no
   PostScript: no
   PDF:        no
   SVG:        yes
   glitz:      no

the following font backends:
   FreeType:   yes
   Win32:      no
   ATSUI:      no

[...]
In file included from cairo-font-subset.c:37:
cairo-pdf.h:65:3: error: #error Cairo was not compiled with support for 
the pdf backend

which is obviously bad.  Now when I try configuring with 
--enable-pdf...and it compiles and installs.

I notice the default DPI is 300.  This should be changed to 90; see 
http://www.w3.org/TR/REC-CSS2/syndata.html.  It's not entirely clear to 
me how DPI and width_in_points issues should be handled in the interface.


I would like to be able to create an SVG into a fixed or variable-sized 
buffer rather than being forced to stream it or give a filename. 
Couldn't it take a FILE* instead?  But, I guess this is the way image 
surfaces do it...

So next I tried converting svg2png into svg2svg.  The attached patch 
does this.  Instead of rendering to an image surface we just render to 
an SVG surface.  However it segfaults:

(gdb) bt
#0  0x00000000 in ?? ()
#1  0xb7e83e9d in _cairo_surface_get_extents (surface=0x80546d0,
     rectangle=0xbfdaa628) at cairo-surface.c:1493
#2  0xb7e7a338 in _cairo_gstate_paint (gstate=0x8054ab0) at 
cairo-gstate.c:743
#3  0xb7e7523c in cairo_paint (cr=0x8054730) at cairo.c:1409
#4  0x080496a7 in render_to_png (svg_file=0x804b008, png_file=0x804b170,
     args=0xbfdaa6fc) at svg2png.c:199
#5  0x08049193 in main (argc=3, argv=0xbfdaa7c4) at svg2png.c:76

the reason being that surface->backend->get_extents is NULL.

-jason


More information about the cairo mailing list