W3C home > Mailing lists > Public > www-svg@w3.org > February 2012

Re: path data attribute lacks units!

From: <seb@highlab.com>
Date: Thu, 09 Feb 2012 09:22:22 -0700
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: www-svg@w3.org
Message-Id: <E1RvWl7-00059M-Tk@highlab.com>
Thanks, Tab and Brian, that helped a lot!  I didnt realize I could define the physical dimensions of the px user unit that way, but it makes sense.  That's totally fixed my problem :-)

----- Reply message -----
From: "Tab Atkins Jr." <jackalmage@gmail.com>
Date: Thu, Feb 9, 2012 03:16
Subject: path data attribute lacks units!
To: "Sebastian Kuzminsky" <seb@highlab.com>
Cc: <www-svg@w3.org>


On Wed, Feb 8, 2012 at 9:09 AM, Sebastian Kuzminsky <seb@highlab.com> wrote:
> Hi there, I'm working with a group of people in the open source world, trying to use SVG as an interchange format for 2-dimensional CAD (computer-aided design) data. We are hoping to replace the old closed-source DXF format with SVG, and we're mostly having good success.
>
> However, we have run in to one stumbling block.  Some shapes can be well represented by SVG Basic Shapes, and those work well.  Some shapes cannot be represented by Basic Shapes and instead require Paths, for example partial arcs.
>
> The problem is that Path data does not have user-specifiable units.  It is always represented in "px" user units, which have undefined size.  We're currently assuming that the SVG will be viewed/used in a 90 dpi environment, and that is getting us past this obstacle, but it seems an unsafe assumption to make.  We'd much rather have proper units on path data, and remove this ambiguity.
>
> Is this limitation intentional?
>
> Is there a way to specify path data units that we're missing?
>
>
> Thanks for your work on a (mostly!) great spec!  :-)

The size of a userspace unit (the numbers without explicit unit
identifiers) is determined by the size of the SVG itself and the
viewBox attribute.  The viewBox defines how many userspace units fit
into the space that the SVG occupies.

For example, with something like:

<svg width='10in' height='8in' viewBox='0 0 100 100'>...</svg>

Inside of the SVG, a userspace unit is a rectangle .1in wide and .08in tall.

~TJ
Received on Thursday, 9 February 2012 16:22:46 GMT

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