Units in Inkscape =================
Introduction -----------
The recent debate about units in Inkscape highlights the fact that we do not have a clearly defined approach on how to handle units in Inkscape. Units are not as straight-forward as one should think they are. This essay attempts to resolve this problem.
Historical View ---------------
Part of the problem with units in SVG and CSS in general is why they are there in the first place. In the early days it was assumed that one would want to display drawings on a screen at full scale. In other words, a "one inch square" would be display on a screen as a physical one inch square. This required that displays be queryable as to what there true DPI was. Display manufactures rarely provided the means to query the DPI of the display, and when they did, they often returned incorrect results. Thus, the use of "real" units never became popular and in reality is usually not what one wanted. Eventually, after long arguments, the CSS working group dictated that one inch would be fixed to 96 pixels regardless of screen resolution (ironically, with so called "Retina" displays, there is once again interest in scaling drawings based on DPI).
A Philosophy ------------
Absolute units should not be used inside an SVG file with one exception:
The 'root' width and height may have units, which with a proper 'viewBox' determines an appropriate scale for a drawing. (This sets the 'real' world value of the SVG 'user unit.) This reflect the opinion of the majority of the SVG working group.
It should be noted that the relative units 'em', 'ex', and '%' can be useful in some cases.
Inkscape & Units ----------------
Inkscape should not write out absolute units other than in the root SVG element. Inkscape must, however, be able to interpret units from non-Inkscape produced files according to the CSS defined value of 96 pixels (initial user-units) per inch.
The use of units in the Inkscape GUI is for ease of authoring only. The actual values should be stored as 'user-units'.
Changing the "Inkscape GUI unit" should not introduce any 'transforms' on elements (as seems to being done now) nor should changing the SVG root 'width'/'height units or the 'viewBox'.
The GUI should reflect the chosen Inkscape GUI unit scaled to take into account the SVG root 'width'/'height' and 'viewBox'.
For example:
<svg width="100mm" height="100mm" viewBox="0 0 100 100">
describes a drawing 100mm x 100mm where one 'user-unit' is equivalent to one mm.
If the Inkscape property inkscape:document-units="mm" then the GUI would show a width of '25.4' for a rectangle 25.4 'user-units' wide. If inkscape:document-units="in", the GUI would show '1.0'.
To implement this, one either needs to find the proper scaling from examining the SVG root 'width'/'height' and 'viewBox' properties or create a new Inkscape property that fixes this scale (in which case changing the 'width'/'height' would change the 'viewBox' and vice versa).
Tav