Re: Aspect ratios in SVG: Numbers or integers?

I appreciate the drive for consistency, but it's kinda odd:  aspect ratio is, well, a rational number, and rational numbers are usually expressed as a pair of integers.

On May 7, 2010, at 9:57 , Chris Lilley wrote:

> On Friday, May 7, 2010, 6:22:03 PM, Tab wrote:
> 
> TAJ> In the CSS list we're discussing an aspect-ratio property which would
> TAJ> hold a box to a particular width/height ratio.  Currently the proposed
> TAJ> syntax is for the property to take a single <number> or two
> TAJ> <integer>s.
> 
> TAJ> Someone on the list pointed out that he thought SVG allowed aspect
> TAJ> ratios to be specified with two numbers (that is, something like "8 by
> TAJ> 4.5" rather than "16 by 9").  He couldn't find a reference when I
> TAJ> asked for it, though.
> 
> Look at the definition of the viewBox attribute
> http://dev.w3.org/SVG/profiles/1.1F2/master/coords.html#ViewBoxAttribute
> 
> "The value of the ‘viewBox’ attribute is a list of four numbers <min-x>, <min-y>, <width>  and <height>, separated by whitespace and/or a comma"
> 
> where number is defined here
> http://dev.w3.org/SVG/profiles/1.1F2/master/types.html#DataTypeNumber
> 
> 
> TAJ> So, in similar situations where you specify an aspect ratio as two
> TAJ> numbers, does SVG have any prior art on whether the two should be
> TAJ> integers or numbers?  I'd like it to match if so.
> 
> Two numbers. Note that currently, the definition of number in SVG depends on whether it has to disallow scientific notation to fit in with CSS grammar, or not. So in a stylesheet, its
> 
> number ::= integer
>           | [+-]? [0-9]* "." [0-9]+
> 
> while in an attribute (such as viewBox), its
> 
> number ::= integer ([Ee] integer)?
>           | [+-]? [0-9]* "." [0-9]+ ([Ee] integer)?
> 
> 
> 
> Its also worth noting that viewBox is establishing a coordinate system, not just an aspect ratio. So
> 
> 0 0 16 9
> 0 0 16000 9000
> 
> establish different coordinate systems, but the same aspect ratio.
> 
> -- 
> Chris Lilley                    mailto:chris@w3.org
> Technical Director, Interaction Domain
> W3C Graphics Activity Lead
> Co-Chair, W3C Hypertext CG
> 
> 

David Singer
Multimedia and Software Standards, Apple Inc.

Received on Friday, 7 May 2010 18:18:17 UTC