SVG: scaling if no width/height is given
rb.henschel at t-online.de
Tue Jun 18 16:24:48 PDT 2013
Christina Roßmanith schrieb:
> the problem described here ->
> https://bugs.freedesktop.org/show_bug.cgi?id=64125 is caused by a
> missing width and height attribute of the SVG given as an example. So,
> what would we expect given a ViewBox attribute when importing a graphic?
> What I'd expect is that the aspect ratio is kept and a reasonable
> scaling is applied in order to fill a page, table cell or whatever. And
> that the little green squares (handles?) behave like a bounding box for
> the graphic content. Is that correct?
I understand it this way: In Writer the textarea should be the
'viewport'. If no attribute preserveAspectRatio is given, the default is
used, which is preserveAspectRatio="xMidYMid meet". So because of the
value 'meet' the svg element has to be scaled so, that aspect ratio is
preserved and the entire viewBox is visible and is as large as possible.
Because of the value 'xMidYMid' the viewBox has to be centered in the
> What I've achieved so far is the correct scaling.
I'm not sure about it. What do you scale?
What I'm looking for
> is where the total size of the graphic is still determined wrong (see
> attached screenshot) -> little green squares are more like DIN A4 than
> the ViewBox size.
I too would expect, that the bounding box of the element is equal to the
viewBox. I wonder, why this does not happen. Perhaps the transformation
is wrong? Where do you make your changes?
I think, that the initial target size is set to DIN A4 as fallback in
SvgSvgNode::decomposeSvgNode in the part about "Outermost SVG element".
I guess that the real target size is unknown at that point and you need
to transform the svg object after insert in the draw page.
Perhaps you ask Armin, who is the author of the svg parts.
More information about the LibreOffice