[cairo] svg_cairo_get_size problem

Jason Dorje Short jdorje at users.sf.net
Thu Jun 23 22:55:49 PDT 2005

There appears to be a problem in svg_cairo_get_size in libsvg-cairo in
current CVS causing it to return inaccurate values.

The attached SVGs (chosen for their smallness) show a working and a
nonworking SVG file.  If you use svg2png or xsvg on the cornwall flag it
will be incorrect, but on the galicia flag it works correctly (or at
least I think so; if not I have other examples that do work correctly).

The error is somewhere inside svg_cairo_get_size.  Basically this
function just returns a size that is too large.  Thus when svg2png does
its own scaling it creates a backing store that is too large (or if you
 use the -w parameter, the backing store is the right size but the image
is too small on it).  The end result is that some areas to the right and
bottom are transparent.

The error is that instead of returning a value that is in pixels, the
dimensions returned are in centi-inches.  When I look at these files in
inkscape I can see the dimensions in points, pixels, or inches.  The
calculation of inches seems to assume a 90 DPI rate (I don't know if
this is system-specific or inkscape-specific).  In the erronous SVG
files the dimensions being returned by svg_cairo_get_size are exactly
100x larger than the inches values shown in inkscape - perhaps
libsvg-cairo is assuming 100 DPI or something.  In the correct SVG
files, inkscape again shows inches based on 90 DPI but the dimensions
returned by svg_cairo_get_size correspond to the pixel dimensions not to
these inch dimensions.

That's really all I've been able to track about this bug.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cornwall.svg
Type: image/svg+xml
Size: 1637 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050624/524fc822/cornwall.svg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: galicia.svg
Type: image/svg+xml
Size: 813 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050624/524fc822/galicia.svg

More information about the cairo mailing list