Re: absolute coordinates on svg paths

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 UTC