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

Re: absolute coordinates on svg paths

From: MenTaLguY <mental@rydia.net>
Date: Sun, 01 Jan 2006 15:13:57 -0500
To: Jose Ignacio Villar <jvillar@gmail.com>
Cc: www-svg@w3.org
Message-Id: <1136146439.7197.5.camel@localhost.localdomain>
On Sun, 2006-01-01 at 19:49 +0100, Jose Ignacio Villar wrote:
> In the file there are rects, circles, etc,...  that represents real
> life shapes with absolute dimensions in inches and mm.
> I've succed to implement circles, ellipses, ovals rects etc, with SVG
> built in absolute meassures, but i've found I can't do the same with
> paths :(. 

You don't really want to do it that way -- the way SVG was designed, you
should establish the document dimensions in absolute dimensions, use
viewBox to establish the absolute -> user coordinate relationship, and
then specify everything else in user coordinates.

For example:

 <!-- this viewBox establishes a 1:1 relationship between user units and
inches -->
 <svg xmlns="http://www.w3.org/2000/svg" width="300in" height="200in"
viewBox="0 0 300 200">
   <!-- 40"x80" rectangle, with corner at (10",10") -->
   <rect x="10" y="10" width="80" height="40"/>
 </svg>

Note that viewBox applies a scaling transformation rather than changing
the "dpi" of the document, so within the viewBox'd svg, absolute units
won't do what you expect.

-mental


Received on Sunday, 1 January 2006 20:14:07 GMT

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