SVG: scaling if no width/height is given

Thorsten Behrens thb at documentfoundation.org
Wed Jun 19 02:10:32 PDT 2013


Christina Roßmanith wrote:
> 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?
> 
Hi Christina,

hmm - since there is no viewport given, I'd assume svg takes the whole
surrounding space, i.e. the draw page in this case. The ViewBox would
then be relative to that user coordinate system, scaling the content
to fill it. Since there is no preserveAspectRatio given, I read the
spec that then the default of xMidYMid is taken, so indeed scaling
should be uniformely. Does that match your reading?

That would be using:
 - http://www.w3.org/TR/SVG/coords.html#ViewportSpace
 - http://www.w3.org/TR/SVG/coords.html#EstablishingANewViewport
 - http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute
 - http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute

> What I've achieved so far is the correct scaling. 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.
> 
Can you submit the patch (gerrit preferred, you can give yourself a -1
review to prevent Fridrich from merging it straight away ;)), would
need to look into that a bit. :)

Cheers,

-- Thorsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20130619/90c68a91/attachment.pgp>


More information about the LibreOffice mailing list