W3C home > Mailing lists > Public > www-svg@w3.org > September 2011

Re: bounding box of inline SVG

From: Rik Cabanier <cabanier@gmail.com>
Date: Mon, 12 Sep 2011 12:05:14 -0700
Message-ID: <CAGN7qDB3=JiqfcgQDROR1az2xdf+zV+64Usar0+gyA025mx+wg@mail.gmail.com>
To: "Dr. Olaf Hoffmann" <Dr.O.Hoffmann@gmx.de>
Cc: www-svg@w3.org
2011/9/12 Dr. Olaf Hoffmann <Dr.O.Hoffmann@gmx.de>

> Hello,
> what is the idea, how this should work to calculate it automatically,
> if neither the author of the SVG nor the embedding document gives
> information
> about the intended size of the graphics?

If the graphics use absolute coordinates, you can calculate their bounding
Then by unionizing all the bboxes and account for the transformation
matrices, you would come up with the bounding box of the svg element itself.
If they use relative coordinates (like '%'), you would calculate the
absolute coordinate which allows you to calculate the bbox.

> Many of my SVG documents have parts of graphical objects out of the viewBox
> and for several of them it depends on the preserveAspectRatio, what is the
> intention to display, if the aspect ratio of the viewport does not fit to
> the
> viewBox. Obviously, if the embedding document does not provide information
> about size or at least aspect ratio of the viewport, I cannot see how to
> calculate this automatically.

With no 'width' or 'height', viewBox becomes meaningless.
It would also need to be calculated on the fly. Not to change the aspect
ratio but to change where the (0,0) point will be located.

> On the other hand, for an author of the embedding document it is typically
> simple to provide information about the available viewport, as well as for
> a browser to know the viewport size, if the SVG is not embedded at all.
> Or if size matters for the SVG, it should be simple for the SVG document
> author to provide information about width and height (apart from the
> practical problem, that typical browser do not manage to display absolute
> sizes properly anyway).

I believe that in the future, the author will typically create the HTML and
the inline SVG.
We shouldn't think about them as separate worlds. (I think there was
consensus about this at the Seattle F2F.)
If I move an inline SVG element, I don't want it to be clipped by the parent
SVG header unless I specified a 'width'/'height'

Received on Monday, 12 September 2011 19:05:43 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:26 UTC