Very quick reply, sorry.
On 12-9-2014 18:32, Tavmjong Bah wrote:
On Thu, 2014-09-11 at 22:47 +0200, Johan Engelen wrote:
On 11-9-2014 14:58, Tavmjong Bah wrote:
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.
This is not true, from my point of view. We had and have a very clearly defined approach to units. This was implemented as part of a GSoC project last year, and has not changed. The approach has been communicated several times on the mailing list. Inkscape is behaving exactly as you write in your email. If it is not, it is a bug, and we are aware of some of them.
I've just looked back at the mail archives. I can find parts of the approach described in the emails but it is hard to pick out the overall philosophy. I have started a wiki page for future reference. Please review:
Thanks.
Some issues that we are aware of for a long time now (you touch upon some of them in your mail):
- explicit units in certain areas (font size, stroke width, ...)
- "px" should be renamed
I don't think renaming 'px' is a good idea. While it perhaps was not the best choice for 'user unit' it is what web developers are use to seeing.
We just have to make sure people don't mistake it for "pixel". (or, make sure the ratios are such that it *is* pixel) Somehow I remembered vaguely something that "px" actually means "user unit" in the SVG spec, but I see that this is not true.
- bugs related to toplevel width/height specs without units (e.g. in our
default document template) or it going out-of-sync with inkscape:document-units.
I don't really understand the need for 'inkscape:document-units'. Can't this be determined by looking at the 'width' and/or 'height'? Then there is no problem with keeping things in sync.
Not always. Set the page size to A4 in mm, then change doc units to something else. The width of the page is still expressed in mm, but the viewbox is such that document units become whatever you chose. It's hard to infer from width/height and viewbox what unit was chosen.
On 11-9-2014 14:58, Tavmjong Bah wrote:
Changing the "Inkscape GUI unit" should not introduce any 'transforms' on elements (as seems to being done now)
Inkscape is not doing the transforms thing. David Mathog added code that did so, and subsequently removed that code.
I've just run a test on r12558, which should predate David's code changes. If one creates a rectangle inside a document with
inkscape:document-units="mm"
and with the preference setting "Store Transformation" set to "Preserve", a scaling transform is added. This is not what I would expect.
Just tried it and indeed saw a transform added to the rectangle, but it was a translate (1.2323e-5, 0). Strange rounding error thingie that should not be there: bug.
On 11-9-2014 14:58, Tavmjong Bah wrote:
<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'.
inkscape:document-units is exactly that: *document* units. Not UI units. Although in practice, the default unit in the UI is taken from inkscape:document-units. If document-units is different from the unit defined by
<svg width="..." height="..." viewBox="...">
then that is the start of a disaster; it is a bug to allow that to happen.
It can happen with the XML editor...
Yes. Bug.
I do not know why it seems that there is no clear view about how we want units to behave. (sorry, I'm pissed off about again a unit discussion where we have to reiterate the basics)
Relying on collective memory of long email threads from the past is not the best way to preserve a clear view. Hopefully, the Wiki page I started will help.
Thanks again.
-Johan