On Mon, 23 Sep 2013 23:45:11 +0200 Johan Engelen <jbc.engelen@...2592...> wrote:
You know more about SVG than me, but, "user unit" =/= "px" right?
Here's the relevant quote from the SVG specification:
http://www.w3.org/TR/SVG/coords.html#Units
One px unit is defined to be equal to one user unit. Thus, a length of "5px" is the same as a length of "5".
That seems pretty definitive. "px" is perhaps an unfortunate abbreviation for "user units", because it does NOT mean "pixels":
in most circumstances, "px" units will not map to the device pixel grid.
On Mon, 23 Sep 2013 19:55:54 -0400 Matthew Petroff <inkscape-devel@...2975...> wrote:
It's a result of Inkscape using a fixed pixel to real world unit ratio. Per my reading of the SVG spec, the SVG user agent should determine the size of 1px, i.e. 1 user unit, and set the other unit ratios accordingly. In this case, since the document size is specified in real world units and a viewBox is set, Inkscape should calculate the size of one px from this and set the size of 1in to be 1px. However, Inkscape's current behavior of using a fixed 90px/in ratio is consistent with Firefox, Chrome, GIMP, Eye of GNOME, and gThumb (everything I tested).
Everything else is wrong.
The other absolute unit identifiers from CSS (i.e., pt, pc, cm, mm, in) are all defined as an appropriate multiple of one px unit (which, according to the previous item, is defined to be equal to one user unit), based on what the SVG user agent determines is the size of a px unit (possibly passed from the parent processor or environment at initialization time). For example, suppose that the user agent can determine from its environment that "1px" corresponds to "0.2822222mm" (i.e., 90dpi). Then, for all processing of SVG content:
- "1pt" equals "1.25px" (and therefore 1.25 user units) - "1pc" equals "15px" (and therefore 15 user units) - "1mm" would be "3.543307px" (3.543307 user units) - "1cm" equals "35.43307px" (and therefore 35.43307 user units) - "1in" equals "90px" (and therefore 90 user units)
This "for example" is the only mention of the 90px/in ratio. There is no suggestion that this should be considered a normative value.
It seems rather silly that a vector graphics program would be much concerned with "dpi" or "pixels" anyway, except when exporting to a raster image. Since it's up to the the "SVG user agent" to "determine the size of a px unit", shouldn't Inkscape do so by adopting whatever is specified as the default unit for the document? Doesn't "viewBox" provide for compatibility with the other programs that you mentioned? Why should Inkscape be constrained by their defective interpretation of the SVG specification?
On a somewhat related subject, could you comment on the current significance (after your work) of the "units.txt" and "units.xml" files? When I tested this earlier, these files contained duplicate information, but it seemed that some unit definitions were compiled into the program, and some were taken from "units.txt", whereas "units.xml" had no influence whatsoever.
It would seem to make sense that all unit definitions should be taken from one or more external files, rather than compiled in, so that new or changed definitions could be added easily. If XML was chosen as the file format, this would make it easier to specify the conversion factors between different measurement systems, without having to use seven-digit decimal fractions, as above. See example here:
http://sourceforge.net/mailarchive/message.php?msg_id=30063581
-- Ian Bruce