W3C home > Mailing lists > Public > www-svg@w3.org > January 2006

Re: Is the px unit equivalent to user units?

From: Jonathan Watt <jonathan.watt@strath.ac.uk>
Date: Wed, 04 Jan 2006 17:47:24 +0000
Message-ID: <43BC0A2C.80701@strath.ac.uk>
To: www-svg@w3.org, Doug Schepers <doug@schepers.cc>

Doug Schepers wrote:
> Hi, Jonathan-
> 
> Jonathan Watt wrote:
> [...]
> | '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".' 
> [...]
> | But a little further on you find the sentence: 'Note that use 
> | of px units or any other absolute unit identifiers can cause 
> | inconsistent visual results on different viewing environments 
> | since the size of "1px" may map to a different 
> | number of user units on different systems'.
> | 
> | How can you reconcile these statements? Is the latter 
> | statement a mistake, or is there a reason for it? 
> 
> I think that it's a bit of a sticky thing to wrap one's head around. As best
> as I can make out, neither statement is not always correct. If you have
> specified px units on an element, the size of the device screen in
> combination with the initial viewBox and the zoom level will almost
> certainly mean that the device pixels are not the actual measurement of the
> element's geometry.

Sure, that's expected because despite its name the, px unit isn't a measure of 
device pixels. It's not what I'm asking though. I'm asking is a length of "5px" 
is always the same as a length of "5"?

> So, equating user units to pixels (or even using pixels
> as a unit) is almost certainly semantically wrong,

Well the same applies to all the other units. Anyway, I'm not interested in the 
semantics right now, I'm only interested in the question I posed at the start of 
this thread.

> and most likely literally
> wrong as well.

I'd be grateful if the WG could give a concrete answer to my question. As you 
know I appreciate you answers, but a "most likely" is not so helpful.

> This may be a legacy from CSS's insistence on unit values, or a carryover
> from some earlier mechanism or scenario discussed in the SVG WG, but I don't
> think that they are particularly relevant to the current realities of SVG.

If so I'd appreciate a WG member making a statement to the effect that the 
latter paragraph is wrong and will be removed at some point.

> In fact, I much prefer the way SVG Tiny 1.2 approaches the problem, by
> moving all unit measurements to the root.

Okay, but the question at hand is of pressing importance to make sure the advice 
being given today isn't going to give people problems later. In this thread, I'm 
not so interested in what might happen in the future with SVG Tiny 1.2.

> The only place I see this falling
> down is in relative units such as percentages, em, and ex, which may still
> be useful. I would like to see the 'px' unit deprecated in SVG, in favor of
> 'uu' (user units) or 'csu' (coordinate space units).

First of all I don't see any point in making px == user units == 
uu/csu/whatever. If px is always equal to user units then we have what we need. 
px isn't a measure of device pixels.

Secondly I think you know my opinion on deprecating things. Implementations 
still have to implement whatever you deprecate to be compatible with 
pre-existing content, so that isn't a great option.

> | Is the advice I'm giving sound or not?
> 
> I would personally prefer the reverse advice, if it's practical.

The advice I'm giving is for people to use px for lengths in CSS wherever they 
would have omitted a unit (in the belief that px is always equivalent to user 
units). The opposite advice is not practical because then the CSS is in error in 
Firefox and I guess in any other future multi-namespace 
CSS-supporting-and-conforming UA.

> Since SVG
> Tiny 1.2 will not allow CSS units, it would be better to advise people not
> to use CSS at all, except possibly in the case of stylesheets (which you do
> state on your page).

Thanks for your reply Doug.

Jonathan
Received on Wednesday, 4 January 2006 18:39:09 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:33 GMT