[csswg-drafts] [css-fonts] Suggest allowing a list of font-family values in @font-face (#3691)

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

== [css-fonts] Suggest allowing a list of font-family values in @font-face ==
@font-face only allows a single value for the "font-family" entry, but I can't think of a reason that a list shouldn't be allowed here, and at times it could be useful.

An example: "NotoSans-Black.ttf" has two names in the OpenType name table: "Noto Sans" and "Noto Sans Blk". While best practice would be to define the Noto sans families like so:
```
@font-face {
    font-family: "Noto Sans";
    font-weight: 900;
    url(NotoSans-Black.ttf);
}
@font-face {
    font-family: "Noto Sans";
    font-weight: 400;
    url(NotoSans.ttf);
}
```
I can't think of any ambiguity that would arise if you could also do this:
```
@font-face {
    font-family: "Noto Sans", "Noto Sans Blk";
    font-weight: 900;
    url(NotoSans-Black.ttf);
}
@font-face {
    font-family: "Noto Sans";
    font-weight: 400;
    url(NotoSans.ttf);
}
```
This would be also useful if the font has names in several languages, eg "MS Mincho" and "MS 明朝". In fact that's probably a more compelling usecase, I should have opened with that really.

Finally, it's also an advantage when generating @font-face rules automatically from font files; there's no need to choose which of the several names an OpenType font is known by as the definitive one, you can just list all the appropriate entries.

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

Received on Thursday, 28 February 2019 12:10:30 UTC