Re: Aligning specs of OT1.8.1 wght variation axis and CSS font-weight

On Fri, Mar 31, 2017 at 5:01 PM, Myles C. Maxfield <mmaxfield@apple.com> wrote:
>
>> On Mar 31, 2017, at 9:37 AM, Laurence Penney <lorp@lorp.org> wrote:
>>
>> There are some oddities in the CSS spec, in OT1.8.1 and in the WebKit implementation about valid values for a font’s weight.
>>
>> CSS:
>> <number> "Only values greater than 0 and less than 1000 are valid" [1]
>> This implies that the values 0 and 1000 are both invalid. By use of <number>, integers are not mandated, and indeed fractional values will presumably be common with variable fonts. It’s unclear what the smallest and largest valid values are, but maybe that doesn’t matter. I suggest it would be more elegant if the spec allowed the extremes, thus 0 <=  n <= 1000.
>
> 0 can’t be allowed here because of parsing ambiguity in the “font” shorthand. In particular, length values of 0 don’t have to include a unit. This means that if 0 weight would be allowed, there would be no way to differentiate between a weight of 0 and a font-size of 0 inside the font shorthand. I took the same approach with 1000 just for symmetry.

Note that open ranges (such as (0, 1000)) aren't allowed in CSS.
Disallowing 0 is fine, but you have to provide a lower bound, such as
1, or define a behavior that handles values that approach 0 (such as a
UA-defined minimum that values are floored to).  Disallowing 1000 (but
allowing 999.9999999) isn't allowed.  (This is all per CSS design
principles; there's nothing that magically disallows this stuff except
convention).

~TJ

Received on Saturday, 1 April 2017 00:41:41 UTC