
Hi!
Problem 1:
I have switched everywhere (in inkscape) to unit mm. I only want to use that unit (and not px), for everything. Now, when I move something on canvas (or just a node) inkscape still write into the svg file the coordinates without unit (so pixel) and it calculates back and forth between pixel and millimeter. This approach has two disadvantages: - almost impossible to hand edit the resulted file or correct some inaccuracies in it. (because I need a calculator when I want to touch the file) - inaccuracies inserted for sure
Problem 2:
If I specify the unit in svg file, inkscape does not handle it, and misinterprets the file!
Two Examples: 1:
<path d="M 0,0 L 30mm,0 L 30mm,30mm L 45mm,30mm" id="path7887" />
becomes in inkscape (after modifying something in xml editor (ex: style), or moving a node):
<path d="M 0,0 L 30,0 M 30,0 L 30,0 M 60,0 L 45,0" id="path7887" style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
Second example: <g transform="matrix(1 0 0 -1 0 297mm)"> <!-- my graphics here --> </g>
I want to use it for flipping my coordinate (to carteesian coordinate), so I could more easily hand-edit/correct my drawing. But it does not work (I assume because of the unit specificator)
Does anybody know a workaround?
Best regards, Khiraly

This issue is in the tracker at https://bugs.launchpad.net/inkscape/+bug/168753. If anyone comes up with workarounds please post them there...
On Jan 18, 2008 6:16 PM, khiraly <khiraly123@...240...> wrote:
Hi!
Problem 1:
I have switched everywhere (in inkscape) to unit mm. I only want to use that unit (and not px), for everything. Now, when I move something on canvas (or just a node) inkscape still write into the svg file the coordinates without unit (so pixel) and it calculates back and forth between pixel and millimeter. This approach has two disadvantages:
- almost impossible to hand edit the resulted file or correct some
inaccuracies in it. (because I need a calculator when I want to touch the file)
- inaccuracies inserted for sure
Problem 2:
If I specify the unit in svg file, inkscape does not handle it, and misinterprets the file!
Two Examples: 1:
<path d="M 0,0 L 30mm,0 L 30mm,30mm L 45mm,30mm" id="path7887" />
becomes in inkscape (after modifying something in xml editor (ex: style), or moving a node):
<path d="M 0,0 L 30,0 M 30,0 L 30,0 M 60,0 L 45,0" id="path7887" style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
Second example:
<g transform="matrix(1 0 0 -1 0 297mm)"> <!-- my graphics here --> </g>
I want to use it for flipping my coordinate (to carteesian coordinate), so I could more easily hand-edit/correct my drawing. But it does not work (I assume because of the unit specificator)
Does anybody know a workaround?
Best regards, Khiraly
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel

On p, 2008-01-18 at 19:09 -0800, Tom Davidson wrote:
This issue is in the tracker at https://bugs.launchpad.net/inkscape/+bug/168753. If anyone comes up with workarounds please post them there...
Yes the one part of the problem is written there.
But the biggest problem not. Inkscape does handle the unit in px despite is it specified in mm, and misinterpretes the file (L 20 40mm L 10 20 -> L 20 40 M 10 20) which is not only affect the size of the object, but actually modify it!
Thanks for the report, I couldnt find it before.
Khiraly

khiraly wrote:
On p, 2008-01-18 at 19:09 -0800, Tom Davidson wrote:
This issue is in the tracker at https://bugs.launchpad.net/inkscape/+bug/168753. If anyone comes up with workarounds please post them there...
Yes the one part of the problem is written there.
But the biggest problem not. Inkscape does handle the unit in px despite is it specified in mm, and misinterpretes the file (L 20 40mm L 10 20 -> L 20 40 M 10 20) which is not only affect the size of the object, but actually modify it!
"L 20 40mm L 10 20" is invalid SVG. The <path /> d attribute IS specified in px (meaning svg user space units not pixels). Please confer with the grammar in the SVG specification:
http://www.w3.org/TR/SVG/paths.html#PathDataBNF
If you want to use another coordinate system for px you need to use one of the SVG methods for altering the coordinate system: transform or, more likely, viewBox. Please confer with the discussion of Coordinate Systems, Transformations and Units in the SVG spec for details:
http://www.w3.org/TR/SVG/coords.html
My understanding is that you must specify the width and height of your document in real world units and adjust the user space coordinate system to match. For example:
<svg width="20mm" height="45mm" viewBox="0 0 20 45" />
I don't know if you will be able to flip your coordinate system with the viewBox attribute (i.e. viewBox="0 45 20 0").
I'm sure altering Inkscape to work better with other coordinate systems would be welcome.
Someone please speak up if I've gotten this all wrong. :-)
Aaron Spike

Thank you Aaron!
But the biggest problem not. Inkscape does handle the unit in px despite is it specified in mm, and misinterpretes the file (L 20 40mm L 10 20 -> L 20 40 M 10 20) which is not only affect the size of the object, but actually modify it!
"L 20 40mm L 10 20" is invalid SVG. The <path /> d attribute IS specified in px (meaning svg user space units not pixels). Please confer with the grammar in the SVG specification:
Yes, from the grammar, it stands clearly, that the coordinates must be only integer and floating point with sign (2, -2, 2.2, -2.2). No other suffix (mm, in) is permitted.
Thank you for the link, it clarifies a lot.
If you want to use another coordinate system for px you need to use one of the SVG methods for altering the coordinate system: transform or, more likely, viewBox. Please confer with the discussion of Coordinate Systems, Transformations and Units in the SVG spec for details:
I was there yesterday (before posting my question), but surely i must misinterpreted something.
My understanding is that you must specify the width and height of your document in real world units and adjust the user space coordinate system to match. For example:
<svg width="20mm" height="45mm" viewBox="0 0 20 45" />
It clarifies up a lot!
I don't know if you will be able to flip your coordinate system with the viewBox attribute (i.e. viewBox="0 45 20 0").
No, you dont. I think for flipping the coordinate system it must be used the "transform" command.
"Known Issue: Cartesian Coordinate System for SVG" http://support.adobe.com/devsup/devsup.nsf/docs/50556.htm
"7.6 The transform attribute" http://www.w3.org/TR/SVG11/coords.html#TransformAttribute
<g transform="translate(0,[DOCUMENT_HEIGHT]) scale(1,-1)"> <!-- graphics elements go here --> </g>
or
<g transform="matrix(1 0 0 -1 0 [DOCUMENT_HEIGHT])"> <!-- graphics elements go here --> </g>
(all units are in px)
And to translate between px and real coordinate units(mm,in), you must use viewbox at the very beginning.
<svg width="20mm" height="45mm" viewBox="0 0 20 45" />
I'm sure altering Inkscape to work better with other coordinate systems would be welcome.
Sure. But before that it would be nice to discover, what are the standard compliant solutions/possibilities.
So summerizing up, here is a simple svg which are supposed to be standard compliant:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="210mm" height="297mm" viewBox="0 0 210 297">
<g transform="translate(0,297) scale(1,-1)"> <g inkscape:label="1. layer" inkscape:groupmode="layer" id="layer1"> <path style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="M 0,0 L 30,0 L 30,30" id="path7884"/> </g> </g> </svg>
I would like to note here that the link: http://www.inkscape.org/namespaces/inkscape does not work. Dont know if its an error or not.
I attache also a more complete .svg file. For anyone who is interested in this issue.
Aaron: what would be the best method to resolve this issue? Produces simple use cases, and .svg files?
For some, many of us could help. (Like documenting the difference between inkscape behaviour and the expected behaviour)
I try to digg a bit more into it. Maybe working with px units, and after finishing the document I add a viewbox with a text editor would be the temporal solution.
Best regards, Khiraly

khiraly wrote:
I don't know if you will be able to flip your coordinate system with the viewBox attribute (i.e. viewBox="0 45 20 0").
No, you dont. I think for flipping the coordinate system it must be used the "transform" command.
That's too bad. I noticed that Inkscape ignored my attempt to flip the coors with a viewBox, but I'm not sure Inkscape always deals properly with viewBox. I couldn't see it in Firefox. Perhaps it was outside of the visible area. Oh well.
I'm sure altering Inkscape to work better with other coordinate systems would be welcome.
Sure. But before that it would be nice to discover, what are the standard compliant solutions/possibilities.
Whatever gets implemented in Inkscape must be standards compliant of course. But I'm speaking more of the behavior of Inkscape for the user not in the generated markup.
I would like to note here that the link: http://www.inkscape.org/namespaces/inkscape does not work. Dont know if its an error or not.
I don't know either. We might find an answer by reading the Namespaces in XML specification:
http://www.w3.org/TR/REC-xml-names/
Practically, I suspect is doesn't matter until we encounter a validating parser. Am I correct that the use of the namespace URI is to provide a validating parser with information about what is indeed valid?
Aaron: what would be the best method to resolve this issue? Produces simple use cases, and .svg files?
For some, many of us could help. (Like documenting the difference between inkscape behaviour and the expected behaviour)
I'm certainly not the best person to discuss a solution. Documenting your goals with clear words has to be the starting point. I think from there you can search for valid markup to do what you desire. And then work to implement intuitive behavior in Inkscape.
I try to digg a bit more into it. Maybe working with px units, and after finishing the document I add a viewbox with a text editor would be the temporal solution.
Perhaps an XSL transform could be added to Inkscape's saving pipeline to make the modifications and calculations you would make by hand.
Aaron Spike
participants (3)
-
Aaron Spike
-
khiraly
-
Tom Davidson