On 12/26/05, Eric Wilhelm <scratchcomputing@...400...> wrote:
Hi all,
The good news is that svg2crs foo.svg | crs2xar > foo.xar is almost working.
Cool! Where can we try it? What about the reverse translation?
The bad news is that I can't figure out the "right way" to get inkscape units into inches. I found some constants in src/unit-constant.h which tell me that 90 units / inch is set at compile-time, but it seems like the svg file should contain something which makes that explicit.
There are no "inkscape units". They are SVG user units, aka px, aka unnamed unit.
In Inkscape, 1px = 0.8pt. This is fixed and cannot be changed from SVG. Viewbox does not affect that.
The only problem is that other SVG renderers can and do use other fixed values for this (e.g. in Batik it's 0.75 I think). It's a badly defined part of SVG standard. However, it's not a good SVG practice to mix abs units ans px, so this discrepancy rarely bites you. Most real world files just use only px; Inkscape files can only contain abs units in width/height attrs on <svg>. So I think you can use our value of 0.8 at least for now without too many problems.
Of course, the svg spec only rambles on about user-agents determining something from their environment, but that seems way wrong for the uber-converter (what's the dpi of your terminal?) I guess svg was never intended to convey real-world dimensions?
Yes, SVG is primarily for screen. Abs units are an afterthought.
So, it looks like 90 units/inch is a good assumption, but I don't like to assume. Is there a "right way" to do this and/or is it something that inkscape should be writing into its svg?
Unfortunately the answer is no. But you give me an idea - maybe it's indeed worthwhile to add a comment to Inkscape SVG files stating our assumed px/pt ratio?
-- bulia byak Inkscape. Draw Freely. http://www.inkscape.org