[csswg-drafts] [css-fonts] font property descriptors for variable fonts

jfkthame has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-fonts] font property descriptors for variable fonts ==
Re: https://drafts.csswg.org/css-fonts-4/#font-prop-desc

According to my reading of the current spec text, in particular:

> If these descriptors are omitted, initial values are assumed.

> Where a single value is specified, it has the same meaning as a range with identical startpoint and endpoint

> variation values applied to fonts defined with '@font-face' will be clamped to [both] the values specified in these descriptors [...]

it seems that a "naïve" `@font-face` rule such as:

    @font-face {
        font-family: MyVariableFont;
        src: url(fonts/MyVar.ttf);
    }

will result in a face that has a font-weight/stretch/style of `normal`, and will not use variations to implement rendering for other values of these properties. (It might use synthetic bolding and/or obliquing, just like any other non-variable font face.)

This is what Chrome currently implements, AFAICT.

However, it's not what Safari implements; if MyVar.ttf in the above declaration has a 'wght' axis, my understanding (from a colleague's testing) is that Safari will use this to render arbitrary values of the font-weight property. Only if the `@font-face` rule includes an explicit `font-weight` descriptor will it clamp the variation values applied by the `font-weight` property to that range.

ISTM that the Safari behavior is perhaps more author-friendly, but it conflicts with the spec text as it currently stands, and I'm not sure if it makes the interaction of `@font-face` descriptors with font *selection* (as opposed to rendering) trickier to understand/define?

So should this be considered a Safari bug (and will it be fixed to conform to the spec?), or should the spec be revised?

A further question: where the spec says

> variation values applied to fonts defined with '@font-face' will be clamped to [both] the values specified in these descriptors [...]

does this clamping apply to values specified with `font-feature-settings`, or only to values specified in the higher-level properties that correspond to these descriptors? On the face of it, I would understand the spec text to mean that all variation values for the axis corresponding to such a descriptor are clamped (regardless of whether they're specified in `font-feature-settings` or as a higher-level property like `font-weight`); but that does not appear to be the behavior of any current browser (and I'm not sure it would actually be desirable).

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2485 using your GitHub account

Received on Thursday, 29 March 2018 17:15:56 UTC