Issue 122599 - [SVG] DIN A4 is unsuitable as substitute for a missing viewport for SvgSvgNode.
Summary: [SVG] DIN A4 is unsuitable as substitute for a missing viewport for SvgSvgNode.
Status: CLOSED FIXED
Alias: None
Product: Draw
Classification: Application
Component: code (show other issues)
Version: 4.0.0-dev
Hardware: PC Windows 7
: P3 Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL: http://www.w3.org/TR/SVG/coords.html#...
Keywords:
Depends on: 122600
Blocks:
  Show dependency tree
 
Reported: 2013-06-26 21:39 UTC by Regina Henschel
Modified: 2017-05-20 10:33 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Svg graphic to insert. It has only a simple square in size of the viewBox (336 bytes, image/svg+xml)
2013-06-26 21:39 UTC, Regina Henschel
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Regina Henschel 2013-06-26 21:39:49 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.]
Comment 1 Regina Henschel 2013-08-28 12:08:54 UTC
Bounding box is as large as drawing now. Initial size is viewBox size in unit px.
Comment 2 Regina Henschel 2013-08-28 12:42:26 UTC
Verified on AOO4.0.1 r1517538 and trunk r1517803.