W3C home > Mailing lists > Public > www-svg@w3.org > June 2002

Re: What does viewBox really do?

From: <rbw@polyglotinc.com>
Date: Mon, 24 Jun 2002 11:16:52 -0400
Message-Id: <>
To: Dean Jackson <dean@w3.org>
Cc: www-svg@w3.org

At 02:44 PM 6/24/2002 +1000, Dean Jackson wrote:
>The real answer is that is was *very* difficult (as well as processor
>intensive) to implement it the other way around (as you would need
>to inverse transform up the tree to the root and then back down
>again to make sure 1cm is 1cm). So, during Candidate Recommendation
>we received strong implementation feedback to have all units
>converted into user units on document load. We accepted the
>feedback and that's what we have today.

I agree that it is not confusing to convert all units to user coords on
document load, per se. But since the outer <svg> tag acts as a container
of the document, it *is* confusing that it is not taken into account when
doing the conversion.
i.e. why not simply adjust the cm-to-user-coords conversion factor
based on the outer <svg> tag at document load time? In other words,
the default hardware-resolution-based conversion factors would be
overridden if the outer svg defines a new conversion factor.
(Recall previously....
 >At 12:35 PM 6/23/2002 -0500, J. David Eisenberg wrote:
 >Now let's look at the first line. Since the viewport width is 4 cm, you
 >would figure that the line would go only one fourth the way across the
 >rectangle, but it doesn't.
 >That's because the viewport has already been established, and, according
 >to the spec, the "1cm" is going to be translated to user units. One
 >centimeter, given my screen resolution, is 37.8 user units. !!But these
 >user units are now presumed to be in terms of the viewBox!!, and 37.8 out
 >of 80 units is about halfway across, which is exactly what you see.

>The way I think about it is that the viewer converts all units
>to user space when the document is loaded, before applying any
>transformations. Depending on how you look at this it makes sense, e.g.
><g transform="scale(2)">
>   <rect .... width="10cm"/>
>Some people want the rectangle to be 10cm wide, others want it
>to be 20cm (which is what you get with SVG now).
>The viewBox is just another transform.

yes, this example is deceptively intuitive because scale is *relative*
and doesn't use any absolute units in its transform parameters.
I could live with either the 10cm or the 20cm rectangle above; the
problem is the relationship of cm to user coords, given that it appears
to ignore the relationship that I define in my outer <svg>.
Received on Monday, 24 June 2002 11:14:49 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:46:53 UTC