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

Yes, the range of values [1, 1000] is what it should be to match the OT spec.

Vlad


From: mmaxfield@apple.com [mailto:mmaxfield@apple.com]
Sent: Friday, March 31, 2017 9:00 PM
To: Tab Atkins Jr.
Cc: Laurence Penney; www-font@w3.org
Subject: Re: Aligning specs of OT1.8.1 wght variation axis and CSS font-weight

Or maybe [1, 1000]. I dunno, it doesn’t matter much to me.

https://github.com/w3c/csswg-drafts/issues/1157


On Mar 31, 2017, at 5:57 PM, Myles C. Maxfield <mmaxfield@apple.com<mailto:mmaxfield@apple.com>> wrote:


On Mar 31, 2017, at 5:40 PM, Tab Atkins Jr. <jackalmage@gmail.com<mailto:jackalmage@gmail.com>> wrote:

On Fri, Mar 31, 2017 at 5:01 PM, Myles C. Maxfield <mmaxfield@apple.com<mailto:mmaxfield@apple.com>> wrote:



On Mar 31, 2017, at 9:37 AM, Laurence Penney <lorp@lorp.org<mailto: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).

So it should be [1, 999] instead of (0, 1000), I guess.


~TJ

Received on Tuesday, 4 April 2017 11:17:52 UTC