Re: question on spec

Wendell,

At 11:14 AM 6/27/01 +0100, Wendell Piez wrote:
>Hi Jon,
>
>Thanks for being so responsive!
>
>Let me frame the question another way:
>
>What is a "user unit" and what is its relation to a "px" measurement 
>(irrespective of whether the px is an actual pixel size, or an abstract 
>measurement as it evidently needs to be, sometimes)?
>
>Alternatively, what is the difference between:
>
><rect x="0" y="0" width="90" height="90"/>
>
>and
>
><rect x="0" y="0" width="90px" height="90px"/>
>
>or does 7.10 define them to be the same?

The intent is that the above two examples cause equivalent rectangles to be 
drawn.


>It does seem to me that a case can be made that the ratio between pixels 
>and absolute measures such as inches, should be system-dependent. In this 
>case, there'd be a big difference between
>
><rect x="0" y="0" width="90px" height="90px"/>
>
>and
>
><rect x="0" y="0" width="1in" height="1in"/>

Yes, that is correct analysis.


>But this isn't what 7.10 is now saying. Rather, it states that the 
>relation between px and (say) inches is fixed at 90px/in (and so 90 user 
>units / inch). Thus, an SVG "inch" is defined as 90px (90 user units). If 
>this is the case, then an inch is not always an inch, and the line "Note 
>that use of px units or any other absolute unit identifiers can cause 
>inconsistent visual results" makes good sense. But the rationale offered 
>for that statement, "since the size of '1px' may map to a different number 
>of user units on different systems" does not. Rather, it would be because 
>1px is simply not the same size on different systems. But 1px is still one 
>user unit.

Correct again.


>I guess that either (a) SVG should simply define that 1in = 90px, etc. (it 
>following that "absolute" measures are in fact system-dependent (for 
>example on a 120dpi system an "inch" would be 0.75 inches), or (b) SVG 
>should define the relation between px and the absolute measures as 
>system-dependent. It could be that (at least in this context, I can't 
>speak to the whole spec) the concept of "user unit" is getting in the way 
>here -- there seems to be some implicit notion that a user unit is 
>*always* 1/90 in, but a pixel is *not*, but this contradicts the stated 
>definitions.
>
>For now, I guess I'll simply say "an unlabelled measure, e.g. width='100', 
>gives user units, which are actually pixels, and system-dependent; 
>'absolute' units are defined relative to user units, and thus cannot be 
>assumed to correspond to 'real' inches and centimeters". This describes 
>what the viewers are actually doing, doesn't it?

It is a little more complicated that this. For example:

<svg width="100px" height="100px" viewBox="0 0 1000 1000">
    <rect x="0" y="0" width="500px" height="500px"/>
</svg>

Although only three lines long, this one will take some explanation.

In the first line, the 'width' and 'height' attributes indicate that the 
"intrinsic" width/height of the drawing is 100x100 px units. In this case, 
the size of a px is system-dependent. On some systems, 1px might be 1/72in 
or 1/90in or 1/96in or 1/120in. Because "px" units are used there, the size 
of the viewport into which the SVG drawing is rendered will vary from 
system to system.

But now notice the 'viewBox' attribute. This forces a coordinate system 
transformation such that the top/left of the viewport corresponds to user 
coordinate (0,0) and the bottom/right of the viewport corresponds to user 
coordinate (1000,1000). [Because everything is square, we can ignore 
preserveAspectRatio.]

In the second line, the rectangle has width/height of 500/500 "px" units. 
But a "px" is defined to be the same as a user unit, so the rect could have 
been specified as:

    <rect x="0" y="0" width="500" height="500"/>

Above, you said that "user units, which are actually pixels, and 
system-dependent". When I see the word "pixel", I think about the 
individually addressable rectangular bits of phosphor that get lit up on a 
display. With this definition, user units are *NOT* equivalent to pixels 
except possibly in the initial coordinate system on some subset of display 
devices. In the example above, because of the transformation caused by the 
'viewBox' attribute, a user unit is not equivalent to a pixel. 
Transformations via the 'viewBox' attribute or the 'transform' attribute 
are very common in SVG content. I would expect the majority of content uses 
at least one transformation.

But just to reconfirm, the existing language warrants some cleanup.

Jon


>Anyway, thanks for your feedback, and for confirming that you are working 
>on the language. And if I'm getting something wrong here, please let me know!
>
>Regards,
>Wendell
>
>At 12:00 AM 6/27/01, you wrote:
>>Wendell,
>>
>>There will be some clarifications in the Proposed Recommendation of the 
>>SVG specification in this area. Some clarifications have already been 
>>done (by not yet made public), but based on your comments below, I think 
>>additional minor cleanup would help reduce confusion.
>>
>>There are really two situations for "px" units:
>>
>>1) On the outermost 'svg' element, you can define the instrinsic 
>>width/height of the graphic in "px" units. In this use case, a "px" is 
>>generally an system-dependent unit of measure. On many systems, a "px" 
>>will map to one device pixel, and different devices have different 
>>resolutions, so "px" might cause different sizes rendering on different 
>>systems. Also, on very high-res monitors or on printers, a "px" might be 
>>an abstract measurement typically in the range of 1/72 to 1/120 inch, 
>>again possibly causes different rendering sizes on different systems.
>>
>>This case is the reason for the words: "...use of px units ... 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..." But now that you bring this up, I think some additional 
>>rewording may be warranted.
>>
>>2) Otherwise, "A px unit and a user unit are defined to be equivalent in 
>>SVG."
>>
>>Jon Ferraiolo
>>SVG Editor
>>jferraio@adobe.com
>>
>>At 03:59 PM 6/26/01 +0100, Wendell Piez wrote:
>>>Hi,
>>>
>>>How do I reconcile the statement in the SVG CR, section 7.10, "Units":
>>>
>>>"A px unit and a user unit are defined to be equivalent in SVG."
>>>
>>>with the statement, below it, that
>>>
>>>"...use of px units ... 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..."
>>>
>>>Is a 'user unit' a px, or ain't it? what am I missing?
>>>
>>>Thanks,
>>>Wendell
>>>
>>>
>>>
>>>======================================================================
>>>Wendell Piez                            mailto:wapiez@mulberrytech.com
>>>Mulberry Technologies, Inc.                http://www.mulberrytech.com
>>>17 West Jefferson Street                    Direct Phone: 301/315-9635
>>>Suite 207                                          Phone: 301/315-9631
>>>Rockville, MD  20850                                 Fax: 301/315-8285
>>>----------------------------------------------------------------------
>>>   Mulberry Technologies: A Consultancy Specializing in SGML and XML
>>>======================================================================
>
>
>======================================================================
>Wendell Piez                            mailto:wapiez@mulberrytech.com
>Mulberry Technologies, Inc.                http://www.mulberrytech.com
>17 West Jefferson Street                    Direct Phone: 301/315-9635
>Suite 207                                          Phone: 301/315-9631
>Rockville, MD  20850                                 Fax: 301/315-8285
>----------------------------------------------------------------------
>   Mulberry Technologies: A Consultancy Specializing in SGML and XML
>======================================================================

Received on Wednesday, 27 June 2001 12:41:02 UTC