W3C home > Mailing lists > Public > www-svg@w3.org > July 2004

Re: units

From: Cameron McCormack <cam-www-svg@aka.mcc.id.au>
Date: Wed, 14 Jul 2004 14:22:00 +1000
To: SVG List <www-svg@w3.org>
Cc: bulia byak <buliabyak@gmail.com>
Message-ID: <20040714042200.GB326@mcc.id.au>

MenTaLguY:
> That's what I understood...
> 
> What I'm asking, I guess, is if there's an way at all to indirectly
> dimension a path using absolute units like pt or mm or whatever.
> 
> I would have expected something (at least) like this to yield two
> rectangles of equal sizes:
> 
>  <svg width="100pt" height="100pt" viewBox="0 0 100 100">
>    <rect x="25pt" y="25pt" width="50pt" height="25pt" fill="red"/>
>    <path d="M25,50L75,50L75,75L25,75L25,50z" fill="blue"/>
>  </svg>
> 
> ..but if I remember correctly from my experiments, it does not seem to.

In your example the pt values on the rect are going to be evaluated
under the viewBox transformation, which has already effectively
converted user units to pts.  I think you want this:

  <svg width="100pt" height="100pt">
    <rect x="25pt" y="25pt" width="50pt" height="25pt" fill="red"/>
    <svg viewBox="0 0 100 100">
      <path d="M25,50L75,50L75,75L25,75L25,50z" fill="blue"/>
    </svg>
  </svg>

Cameron

-- 
Cameron McCormack
|  Web: http://mcc.id.au/
|  ICQ: 26955922
Received on Wednesday, 14 July 2004 00:22:08 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:14:54 UTC