ISSUE-2378: Consider adding a property for autoscaling

autoscale property

Consider adding a property for autoscaling

State:
RAISED
Product:
SVG 2
Raised by:
Doug Schepers
Opened on:
2010-09-18
Description:
Currently, the way to make an SVG autoscaling is to used percentages instead of specifying a fixed width and height, and to define the dimensions in the viewBox.

For example, instead of
width="600" height="400"
using
width="100%" height="100%" viewBox="0 0 600 400"

While logical, this is not always intuitive or convenient. Common authoring tools (Inkscape, Illustrator) typically default to a fixed width and height, and this seems to resonate with designers' expectations.

Another problem arises with the negotiations of intrinsic width and height when embedding SVG as an images, with an object, etc. in HTML. Defining this has been tricky, and it's not always implemented correctly.

The combination of width, height, viewBox, and preserveAspectRatio is powerful, but the simplest (and far far most common) cases could be solved by adding a shorthand presentation property for the svg root, 'scaling', with values like 'auto', 'fixed', and so forth.

Obviously, we would still need to honor the traditional way of making autoscaling images, and to define precisely how this new attribute would interact with all the combinations of width, height, viewBox, and preserveAspectRatio. To match legacy content, the default value would be 'fixed'.

The advantage of making it a property would be that this could easily be applied via a stylesheet to all the existing SVG content which isn't defined to autoscale, and it would override the existing behavior. It would be more easy for authoring tools to add this than the current method. It could be toggled on and off easily, as well.

Here are some examples of an autoscaling SVG using this attribute would :
<svg width="600" height="400" viewBox="0 0 600 400" scaling="auto">
<svg width="600" height="400" viewBox="0 0 1200 800" scaling="auto">
<svg width="100%" height="100%" viewBox="0 0 600 400" scaling="auto">

This last example would obviously do nothing more than what is done today. Perhaps for simplicity's sake we could define the property such that it only has an effect on an SVG which doesn't have percentages for values of width and/or height.

Related Actions Items:
No related actions
Related emails:
  1. Re: SVG 2 high value use cases based on StackOverflow questions (from paul.lebeau@gmail.com on 2014-12-05)
  2. Re: SVG 2 high value use cases based on StackOverflow questions (from ed@opera.com on 2014-12-04)
  3. minutes, SVG WG Sydney 2012 F2F day 4 (from ed@opera.com on 2012-01-14)
  4. ISSUE-2378 (autoscale property): Consider adding a property for autoscaling [SVG 2] (from sysbot+tracker@w3.org on 2010-09-18)

Related notes:

Related discussion: http://lists.w3.org/Archives/Public/www-svg/2013Dec/0080.html

Erik Dahlström, 4 Dec 2014, 08:22:06

Display change log ATOM feed


Dirk Schulze <dschulze@adobe.com>, Chair, Chris Lilley <chris@w3.org>, Staff Contact
Tracker: documentation, (configuration for this group), originally developed by Dean Jackson, is developed and maintained by the Systems Team <w3t-sys@w3.org>.
$Id: 2378.html,v 1.1 2020/01/17 13:21:34 carcone Exp $