Re: units

On Sat, 2004-07-17 at 02:08, Cameron McCormack wrote:
> MenTaLguY:
> > On Wed, 2004-07-14 at 00:22, Cameron McCormack wrote:
> > 
> > >   <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>
> > 
> > 
> > What if I wanted to specify the path's stroke width in pt?
> 
> Since you know that the viewBox has transformed the space into 1 user
> unit = 1 pt, you could just have stroke-width="1".

> A trickier case
> would be if you want to specify the stroke-width in another unit, like
> em.  I don't see a solution to that, aside from using script to
> determine the equivalent value in user units.

It's also a problem if I want to take the stroke width from a
stylesheet, which doesn't intrinsically "know" the user unit/pt
relationship for all the elements the rule applies to.

> A more complete solution would be to modify the path syntax to allow
> units.  That might make the path data parser more complex, which I guess
> is something the WG try to avoid.

I think just the addition of an additional attribute to indicate path
units would have sufficed in most cases.

As it is, for general use this one misfeature of SVG renders all units
but user units useless.  I woul dbe interested in learning the rationale
behind the decision.

-mental

Received on Sunday, 18 July 2004 01:23:49 UTC