[cairo] svg_cairo_get_size problem
Carl Worth
cworth at cworth.org
Fri Jun 24 11:06:48 PDT 2005
On Fri, 24 Jun 2005 13:36:33 -0400, Jason Dorje Short wrote:
> Your explanation makes sense. But what you're missing is how it can be
> fixed. Maybe the SVG file is broken but a large portion of SVGs are
> broken in this way, and the users of libsvg-cairo often aren't in a
> position to fix them.
If there's a large body of 90 DPI-assuming artwork out there, then we
can change certainly change the default assumed DPI in libsvg-cairo to
match that.
But the files are still broken, and they wouldn't scale properly if we
had something like "svg2png --dpi 600" in preparation for some
high-resolution printing.
> Yet looking at the file I don't see how you can infer 90 DPI.
Here's the math based on cornwall.svg which draws the full background
at width="829.133850" and has a top-level width="234mm".
pixels/inch = 829.133850 pixels/1 width * 1 width/234 mm * 25.4 mm/1 inch
pixels/inch = 89.999999{102564}
The braces here indicate the repeating portion, courtesy of nickle
(http://nickle.org).
So that looks like 90 DPI to me.
> According
> to http://www.inkscape.org/cgi-bin/wiki.pl?ReleaseNotes041 inkscape uses
> 90 DPI as the default.
That same page also indicates:
Note however that the conversion ration from px to absolute
length units may vary in different SVG renderers and different
output media (e.g. Inkscape uses px/pt = 0.8), so you should
not mix px and absolute units in the same document.
The mix of px and absolute units in cornwall.svg is exactly the
problem. I suggested fixing it by changing the top-level width/height
from mm to px using a 90 DPI conversion. It would also work, (but
would be more invasive), to convert all the drawing from px to mm (or
some other absolute unit) using 90 DPI as well.
If inkscape makes it hard to avoid mixing px and absolute units, I
would recommend taking that bug up with that project.
As for fixing a large collection of images, it should be fairly
straightforward to write a little tool to eliminate mixing of
real-world and px units, (the tool would require a DPI value to be
passed in of course).
-Carl
PS. I'll apply the patches shortly.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050624/c0299e87/attachment.pgp
More information about the cairo
mailing list