Re: [csswg-drafts] [css-fonts] Specifying changes to parameters for fallback fonts (#126)

Here's a concrete proposal for this issue.

How about if you could "specialize" font property values for specific fonts. Something like:
```
font-weight: 400 "Helvetica" 500 "Times" 300;
```
to mean "Set the general font-weight to 400, but use 500 for Helvetica and 300 for Times."

These strings would be matched using the usual font-fallback string matching for `@font-face` rules.

There is precedent for something like this: the [`font-feature-settings` at-rule](https://drafts.csswg.org/css-fonts-4/#font-rend-desc) applies font features on a per-font-fallback basis, glyph-by-glyph.

The reason why this proposal isn't an at-rule is that you want cascading to work via selectors for these things, the same way they work for normal font weights. The reason why this isn't a new property is that you want the whole package of font weights to change atomically - you don't want to accidentally forget to reset one font's weight.

The computed value wouldn't have any special smarts in it - it would be computed the same way it's computed today. 

The following properties (and only the following properties) would be augmented with this new syntax:
- `font-weight`
- `font-style`
- `font-stretch`
- `font-size`
- `letter-spacing`
- `word-spacing`
- `line-height`

(An alternative approach would be to have these "specializations" be deltas, and have them cascade independently. So you would say something like `font-weight-specialization: "Helvetica" +100;` and that means Helvetica's glyphs get a `100` bump in font-weight. I think this solution is worse, however, as a bump of weight from 100 to 200 has a very different visual effect than a bump from 800 to 900. Similarly if you tried to do it as a percentage - it wouldn't look right in general. I think a better approach would be to just set the per-font weights in absolute units, just like regular font-weight is set in absolute units.)

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


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

Received on Thursday, 21 January 2021 02:09:18 UTC