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

RE: Is the px unit equivalent to user units?

From: Jon Ferraiolo <jonf@adobe.com>
Date: Wed, 4 Jan 2006 16:36:49 -0800
Message-ID: <6ECA24BE410D994496A2AE995367C5C857627D@namail3.corp.adobe.com>
To: "Jonathan Watt" <jonathan.watt@strath.ac.uk>, <www-svg@w3.org>

Jonathan,
Regarding:
------------ 
I can't reconcile it with the sentence 'the size of "1px" may map to a 
different number of user units on different systems', 
------------

The above sentence from the SVG 1.1 spec is indeed confusing. I am
pretty sure that the above sentence is a leftover from an early draft of
SVG 1.0 when a different set of rules were used for CSS units than what
was ultimately approved for the SVG 1.0 Recommendation.

The comments in the indented section below about absolute units are
still true, but the comment about "px" units need to be stricken. I will
raise an issue with the SVG WG to discuss cleaning up this part of the
spec.

Note that the confusing text is not included in the SVG Tiny 1.2 spec;
thus, if any changes are needed, we are talking about an erratum for
Full 1.1 and updated language for Full 1.2.

Jon

-----Original Message-----
From: www-svg-request@w3.org [mailto:www-svg-request@w3.org] On Behalf
Of Jonathan Watt
Sent: Wednesday, January 04, 2006 11:29 AM
To: www-svg@w3.org; Jon Ferraiolo
Subject: Re: Is the px unit equivalent to user units?


Jon,

Thank you for the reply. In this instance I'm concerned with SVG 1.1
Full.

I've read the text in section 7.10 that you mention, but my point
continues to 
be that I can't reconcile it with the sentence 'the size of "1px" may
map to a 
different number of user units on different systems', also from section
7.10. 
Here's that sentence in context:

   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; thus, absolute units identifiers are only
   recommended for the width and the height on outermost 'svg' elements
   and situations where the content contains no transformations and it
   is desirable to specify values relative to the device pixel grid or
   to a particular real world unit size.

Is this section in error? Either way, yes or no, I would very much
appreciate 
that a WG member say so. If it's not in error an explanation as to how
it can be 
reconciled with the other text you and I have pointed out would also be
appreciated.

Best regards,
Jonathan

Jon Ferraiolo wrote:
> Jonathan,
> 
> In response to your question:
> -----------
> I'm asking is a length of "5px" is always the same as a length of "5"?
> -----------
> 
> The anwser depends on whether you are talking about Tiny or Full, and
> whether you are talking about the width/height attributes on the root
> 'svg' element or other length values within SVG Full.
> 
> In SVG Tiny, the only place where "5px" is allowed is on the 'width'
and
> height' attributes on the root 'svg' element. Assuming a web browser
> context, "5px" said that the intrinsic size of the graphic is 5px,
where
> the definition of px units is the same as the CSS definition of px
> units. Thus, if you have an html:object tag, the SVG graphic should
> appear as the same size on the screen no matter if the html:object
> specifies "5px" or if it specified nothing but uses the instrinsic
"5px"
> from the root 'svg' element.
> 
> In SVG Full 1.1, CSS absolute units are allowed in many other places
for
> length values, but there is a simple algorithm to convert from
absolute
> units to user units via a simple multiple operation. Thus, "1px" is
> equivalent to "1" (i.e., 1 user unit), "1pt" is equivalent to "1.25",
> and "1in" is equivalent to "90". (See
> http://www.w3.org/TR/SVG11/coords.html#Units). The basic idea is that
> all lengths (except for the intrinsic size from width/height on the
root
> 'svg' element) can be quickly converted into user units.
> 
> (Note: I believe the Tiny 1.2 Last Call draft as it stands is
confusing
> in this area. It includes the conversion rules from CSS absolute units
> to user units within section 7.11, but as far as I know there are no
> features in Tiny 1.2 that would ever invoke these conversion rules.)
> 
> Jon
> 
> -----Original Message-----
> From: www-svg-request@w3.org [mailto:www-svg-request@w3.org] On Behalf
> Of Jonathan Watt
> Sent: Wednesday, January 04, 2006 9:47 AM
> To: www-svg@w3.org; Doug Schepers
> Subject: Re: Is the px unit equivalent to user units?
> 
> 
> 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 Thursday, 5 January 2006 00:37:11 GMT

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