[csswg-drafts] [css-fonts] avoid fallback from oblique to italic (#9389)

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

== [css-fonts] avoid fallback from oblique to italic ==
(this is a follow up from https://github.com/w3c/csswg-drafts/issues/8914#issuecomment-1651137267)

When people ask for italic, they typically need to make some kind of semantic distinction from other non italic text. Falling back to oblique text when an italic font-face is not available is reasonable.

However, when people specifically ask for an oblique font, the converse is not true. People asking for oblique specifically want oblique, and falling back to italic is not expected. In particular, unlike italic which is a distinctive style, synthesizing oblique is very doable, and synthetic oblique is much more likely to satisfy the author's expectation than falling back from oblique to italic.

The [definition](https://drafts.csswg.org/css-fonts-4/#font-style-prop) of both values supports this as well:
> * **italic**: Matches against a font that is labeled as an italic face, or an oblique face if one does not exist. 
> * **oblique**: Controls matching against an oblique face. […disucssion of slant…] If no oblique faces exist, and [font-synthesis-style](https://drafts.csswg.org/css-fonts-4/#propdef-font-synthesis-style) has the value auto, a synthetic oblique face will be generated.

So far so good.

However, the subsequent paragraph in the spec is a little ambiguous, but suggest that when picking a font based on a requested angle, priority is given to the angle, and might select from both italic and oblique, regardless of which style is selected:

> A font family might contain no italic or oblique faces, only an italic face and no oblique, only an oblique face and no italic, both an oblique and an italic, multiple oblique faces at various angles, or various combinations thereof. The font matching routine will select a font to use which is closest to the requested angle.

I would initially have suggested an editorial clarification ( maybe "[…]closest to the requested angle <ins>within the requested style, before acceptable fallbacks are tried</ins>."), but upon further inspection, it seems that the actual [font matching routine](https://drafts.csswg.org/css-fonts-4/#font-style-matching) does indeed allow fallback from oblique to italic, in steps 4 to 6 of "If the value of font-style is oblique […]".

So, I would also suggest that these steps 4 to 6 be removed. The vast majority of the time, they should be be reached anyway, as the font sythesis of step 3 will terminate the routine, but in cases where authors have specifically called for an oblique font and no synthesis, swapping in italics isn't what they're calling for.
 

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 21 September 2023 03:06:59 UTC