Hi Christina,
Regina Henschel schrieb:
Hi Christina,
Regina Henschel schrieb:
Hi Christina,
I have seen you patch at Gerrit now.
I think, that SvgAspectRatio::createLinearMapping is the wrong place to
constrain the scaling because this method is used in svgimagenode.cxx
and svgstyleattributes.cxx too. I think, that the decision whether to
keep aspect ratio or not, should be made in the node itself. Have you
tried to set the default settings explicitly in the constructor of
SvgSvgNode?
"constructor" is a bad idea, because it would effect inner svg-nodes too.
I have looked a little bit more around and did some tests with svg-files
in the browser.
(1)
There is
http://www.w3.org/TR/SVG/struct.html#SVGElement
and in the section "preserveAspectRatio" the rule,
"If the attribute is not specified, then the effect is as if a value of
'xMidYMid meet' were specified."
I have made some test in the browser and as far as I see, when for an
inner svg element the attribute preserveAspectRatio is missing, then it
does not use the attribute of the parent svg element, but uses the default.
So in the meantime I think, that it is correct to set the attribute
value 'xMidYMid meet' in the constructor. If the attribute
preserveAspectRatio exists, then SvgSvgNode::parseAttribute will
actualize this value.
With this change you will get already keeping ratio.
(2)
http://www.w3.org/TR/SVG/coords.html#IntrinsicSizing
"If either/both of the ‘width’ and ‘height’ of the rootmost ‘svg’
element are in percentage units (or omitted), the aspect ratio is
calculated from the width and height values of the ‘viewBox’ specified
for the current SVG document fragment."
Therefore I think it is wrong, that DIN A4 is set as default, but the
viewBox has to be used.
Kind regards
Regina
Context
- Re: SVG: scaling if no width/height is given (continued)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.