[csswg-drafts] [css-fonts-4] [Variable Fonts] Angle direction of font-style

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

== [css-fonts-4] [Variable Fonts] Angle direction of font-style  ==
For a variable font that has a `slnt` slant axis, I believe we need clarification on angle directionality of the font-style descriptor for the `@font-face` declaration, because of a discrepancy between the CSS spec and the OpenType axis definition for the `slnt` axis.

The OpenType `slnt` axis definition (https://docs.microsoft.com/en-us/typography/opentype/spec/dvaraxistag_slnt) says:

> Scale interpretation: Values can be interpreted as the angle, in counter-clockwise degrees, of oblique slant from whatever the designer considers to be upright for that font design.

If a variable font has a slant axis the `font-style` descriptor for such a font should specify its support range of slant values with a font style descriptor with a range definition of the form `oblique <angle> <angle>` (from https://www.w3.org/TR/css-fonts-4/#font-prop-desc). 

`<angle>` here refers to the [CSS value type angle](https://www.w3.org/TR/css-values/#angles) which in turn has a non-normative note: 

> By convention, when an angle denotes a direction in CSS, it is typically interpreted as a bearing angle, where 0deg is "up" or "north" on the screen, and larger angles are more clockwise (so 90deg is "right" or "east").

Here the OpenType direction with _positive is left leaning_, _negative is right leaning_ and the CSS angles convention with _positive equals right leaning_ and _negative equals left leaning_ collide.

I believe we need clarification at least about the direction in the font-style property, and in the font-style property descriptor. 

What can be done to resolve this?

I believe we can't touch the OpenType `slnt` axis definition anymore and we should probably not go against the convention of how CSS angles are used either. 

I would suggest we put clarifications in the CSS Fonts spec explaining that...
1) ...when defining the supported range of a \@font-face, the specified range should be in CSS angles, meaning 90 deg clockwise to the right, and -90 deg means to the left. Internally the layout engine will inverse the sign of these values and use this interval as the clamping interval before passing anything to the rasteriser.
2) ...when specifying an `oblique <angle>` value for a CSS font property that this value is to be interpreted as a forward leaning angle relative to the text. 
    * We need to clarify what direction should be used: The text run's direction, or the paragraph direction or any other segment that makes sense from a users' and implementation perspective? (From an implementation point of view I have a slight preference for run direction, @behdad says paragraph direction might make more sense to avoid clashes between LTR slant and RTL slant).
     * From _forward leaning_ depending on text directionality we convert to a geometric angle where positive is clockwise, negative is counterclockwise, which matches what is declared in `@font-face` and is clamped accordingly.
     * From that value, we invert the sign and pass it to the OpenType layer / the font rasteriser.
3) ...when passing a value in `font-variation-settings: slnt φ` then φ should be passed straight to OpenType / font rasteriser without any sign inversion.








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

Received on Monday, 10 September 2018 12:43:04 UTC