Re: [csswg-drafts] [css-fonts] Propose adding lang as a font-face descriptor

I think if the different glyph sets and language specific features are delivered in one font file, then lang attributes plus mapping to the OpenType mechanism is sufficient. 

If the font family is split into language specific fonts for bandwidth savings and language specific subsetting, then I believe this can already be implemented using `:lang()` pseudo selectors and CSS variables, while still keeping the feel of one font family and avoiding unnecessary downloads. [I made an example in this codepen](https://codepen.io/anon/pen/ZqyBao).

If one of the divs is removed, the other font does not download. 

```
<div lang="a">a (shows in cursive)</div>
<div lang="b">b (shows in sans-serif)</div>
```

```
@font-face {
  font-family: Pacifico;
  src: url(//fonts.gstatic.com/s/pacifico/v12/FwZY7-Qmy14u9lezJ-6H6MmBp0u-.woff2)
}

@font-face {
  font-family: Roboto;
  src: url(//https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.woff2)
}

:root :lang(a) {
  --site-font-family: Pacifico;
}

:root :lang(b) {
  --site-font-family: Roboto;
}

* {
  font-family: var(--site-font-family);
  font-size: 50px;
}
```

-- 
GitHub Notification of comment by drott
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1744#issuecomment-428987762 using your GitHub account

Received on Thursday, 11 October 2018 14:57:46 UTC