W3C home > Mailing lists > Public > www-font@w3.org > April to June 2017

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

From: Myles C. Maxfield <mmaxfield@apple.com>
Date: Fri, 31 Mar 2017 17:01:18 -0700
Cc: www-font@w3.org
Message-id: <69CFC8DF-AA75-4510-8488-C56AEF5971FE@apple.com>
To: Laurence Penney <lorp@lorp.org>

> 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.

> 
> OT1.8.1:
> "Values must be in the range 1 to 1000." [2]
> This conflicts with CSS in two ways: that the value 1000 is now valid, and that values between 0 and 1 (exclusive) are now invalid. I suggest this be modified along with the CSS spec, to allow all values between 0 and 1000 inclusive.
> 
> WebKit:
> "Font weights less than or equal to 0, or greater than or equal to 1000 are parse errors" [3]
> I note from this WebKit changeset that Myles Maxfield (for Apple) has assumed that the CSS spec is correct. The characterization as parse errors seems a little odd.
> 
> If it is intended that the wght axis corresponds exactly to CSS font-weight, then the specs should align. Otherwise there may be many fonts where the maximum weight can never quite be achieved, at least not via CSS font-weight.
> 
> - L
> 
> [1] https://drafts.csswg.org/css-fonts-4/?c=S%3BO%3DA#font-weight-prop
> [2] https://www.microsoft.com/typography/otspec/fvar.htm
> [3] https://trac.webkit.org/changeset/214507/webkit
Received on Saturday, 1 April 2017 00:01:53 UTC

This archive was generated by hypermail 2.3.1 : Saturday, 1 April 2017 00:01:53 UTC