[OTVar] CSS draft spec for variations support in web browsers

Laurence Penney
Laurence Penney Posts: 50
edited November 2017 in Font Technology
I encourage anyone interested in Variations Fonts to read the draft CSS spec carefully:

https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control-the-font-variation-settings-property

I was surprised to read this: “Axis values not present in the font, or axis values greater or less than the range supported by the font, are ignored and therefore have no effect…”

I would have thought it makes more sense to clamp values outside the axis’s range to either its max or its min, as recorded in the fvar table, rather than its default. Furthermore, there does not seem to be a way to obtain the max and min values — something that seems to me quite a desirable capability, whether or not there are instances to access them. Would it make sense to allow special values of max, min and default in font-variation-settings? For example:

font-variation-settings: 'wght' default, 'wdth' min;

Note: Webkit Nightly supports font-variation-settings but I have found it unpredictable when using values just within the extremes.
Tagged:

Comments

  • John Hudson
    John Hudson Posts: 3,204
    I like the idea of having max, min and default as settings.
  • Peter Constable
    Peter Constable Posts: 161
    edited October 2016
    I had noticed that.

    The OT 1.8 spec says that an application (or whatever platform layer is doing interpolation) must clamp the requested user values to the axis min/max values defined in the 'fvar' table. Search for the first instance of "clamp" in this page:

    https://www.microsoft.com/typography/otspec/otvaroverview.htm

    Now, in principle, you could view CSS as a higher-level protocol that enforces different requirements. The OT spec doesn't prevent that; the higher-level protocol wouldn't conform to the OT 1.8 guidance for processing variation instance coordinates, but that doesn't necessarily imply that anyone will care.

    But if people do care about what CSS does, they should open issues or comment on issues in the GitHub rep that the CSS WG uses for their process. I have opened an issue for this item (specifically, clamping vs. ignore; I haven't mentioned support for "min" and "max" values):

    https://github.com/w3c/csswg-drafts/issues/647
  • I agree that when the first font has 1-999 and the second has 50-900 and I've asked for 950, and then when toggle/switching families I don't expect the style to jump to the regular in the second, but to 900.

    Being able to ask for max, min, absolute percentage, and relative percentage all seem useful.
  • Thanks for posting that Peter, and explaining where to comment. The ‘fvar’ spec was indeed where I’d recently seen use of the word ‘clamp’ in this context. Agreed that there’s no compulsion for CSS to behave the same way.

    Dave, I like the idea of a percentage along an axis, so 0% gets its min, and 100% gets its max. Could you clarify what you mean by relative and absolute percentage?