Apache OpenOffice (AOO) Bugzilla – Issue 122599
[SVG] DIN A4 is unsuitable as substitute for a missing viewport for SvgSvgNode.
Last modified: 2017-05-20 10:33:48 UTC
Created attachment 80921 [details] Svg graphic to insert. It has only a simple square in size of the viewBox If an outermost svg element has no width/height given, there exists no intrinsic viewport. A browser can determine a viewport from the window into which the svg document is rendered. This is not possible for AOO (right?). Therefore a substitute is used in SvgSvgNode::decomposeSvgNode if width/height is missing. SvgNumber::solve has a similar substitute if a viewport is missing. In both cases a DIN A4 portrait is used as target range. That has disadvantages: The viewBox attribute establishes an intrinsic aspect ratio, see linked spec. It is better if the range used as substitute has exactly this aspect ratio. The target range is the object size in AOO. It is much too large and produces a lot of empty space around the real drawing. So when combining the svg graphic with Draw properties like default gluepoints or background color, these use the larger area instead of the real drawing. In addition a portrait orientation fits badly to the landscape orientation in Impress. The behavior is different from other programs with a paper like canvas. Inkscape imports the svg graphic with viewBox values interpreted in unit px. Corel Draw notices the missing size on import and offers to drag a target range, and otherwise uses a fixed size, but I don't know the unit. Both have the object size same as the viewBox. My suggestion is to do it like Inkscape and set the initial viewport to the viewBox values in unit px in case there is no way to get the real target range. [There is an additional problem with preserveAspectRatio, but that will be covered by another issue.]
Bounding box is as large as drawing now. Initial size is viewBox size in unit px.
Verified on AOO4.0.1 r1517538 and trunk r1517803.