w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.46k stars 658 forks source link

[css-fonts] Access arbitrary points on a variable 'ital' axis via `font-style` #3909

Open davelab6 opened 5 years ago

davelab6 commented 5 years ago

The Microsoft definition of the ital variable font axis (https://docs.microsoft.com/en-us/typography/opentype/spec/dvaraxistag_ital) says,

Valid numeric range: Values must be in the range 0 to 1.

Scale interpretation: A value of 0 can be interpreted as “Roman” (non-italic); a value of 1 can be interpreted as (fully) italic.

...

The Italic axis can be used as a variation axis within a variable font, though this is not expected to be common.

The Italic axis is distinct from the Slant axis ('slnt'). Fonts may use one or the other, depending on the nature of the design, but should rarely use both.

While "not expected to be common" and "should rarely use both" are niceties, there are now such fonts in the wild (eg https://djr.com/roslindale/ - see https://v-fonts.com/fonts/roslindale-variable-italic)

Therefore the current definition of https://www.w3.org/TR/css-fonts-4/#font-style-prop has a problem, because font-style cannot access arbitrary points on a variable 'ital' axis.

litherum commented 5 years ago

@petercon do you have thoughts?

svgeesus commented 5 years ago

So Roslindale Variable Italic has three breakpoints(.25, .5, .75) between 0 and 1 on the ital axis; at each breakpoint a set of glyphs switches between Roman and Italic forms. I presume that the order in which this happens is thought by DJR to convey how strongly this makes the overall face to be "more Italic".

The same effect would normally be achieved by stylistic sets.

@davelab6 I guess you are reporting two problems:

  1. oblique <angle>? is mutually exclusive with norml and italic
  2. there is no italicness <amount>?

It is certainly possible to change this, with normal being a synonym for italicness 0 oblique 0 and italic for italicness 1 oblique 0.

The questions is whether we should, or whether this one font is more of an experiment (perhaps preparatory to an erratum on OFF and OpenType?)

litherum commented 5 years ago

Adding support in font-style would likely lead many CSS authors astray, and doesn’t seem worth it to support advanced functionality in just a single font (or handful of fonts). Indeed, the advanced functionality can already be achieved by using font-variation-settings.

svgeesus commented 5 years ago

related: Getting bent: the current state of Italics in variable font support by @jpamental

jpamental commented 5 years ago

I think it's important to maintain consistency with how static web fonts behave, so I would suggest that when authors specify font-style: italic with a variable font, it should simply set the ital axis to 1. That way you would have the maximum compatibility with non-variable and fallback fonts. And as @litherum points out, authors already have access to set things more specifically via font-variation-settings. (thanks @svgeesus for looping me in!)

davelab6 commented 5 years ago

@litherum I expect ital continuous axes to become common, actually. I don't think it's acceptable to say "this will always be uncommon so we shouldn't support it".

The reason it is important to provide support for selecting any italic angle via font-style is that @font-face family composition allows for a set of static fonts to be used to sample the design space, and font-variation-settings isn't available then

litherum commented 5 years ago

@davelab6 you can put font-variation-settings in your @font-face block. https://drafts.csswg.org/css-fonts-4/#font-rend-desc