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

Personally, I'm not keen on the more complex forms being suggested for properties like `font-weight`, `letter-spacing`, etc., with lists of specific per-family values to be applied. It feels to me like it would become quite cumbersome and hard to maintain.

So I'd like to suggest an alternative approach: how about a new `@`-rule that lets the author create a "virtual" font-family that maps to an existing family, with adjustments that are applied to the computed values of the various rendering properties. This is a bit like the use of `@font-face` with `src:local` to in effect "rename" an installed font and specify (override) its inherent stylistic attributes, but rather than defining individual faces (perhaps many of them, to make up an entire styled family), we're mapping a new family name onto an existing family, while applying adjustments to the rendering.

Something along the lines of:

```
@adjusted-font-family {
  font-family: AdjustedTimes;
  base-family: Times;
  font-size-factor: 1.2; /* or a percentage? */
  font-weight-mapping: 100 100, 400 400, 500 600, 900 1000;
  font-stretch-mapping: 0% 25%, 100% 100%, 200% 150%;
}
```

This would mean that if "AdjustedTimes" is found in the font-family list, we use the "Times" family, but apply the given adjustments to the computed values of the associated style properties. For size, multiplying by a simple factor is probably sufficient; for properties like weight and stretch, the idea is that we can list the desired mapping for one or more values, and intermediate values will then be interpolated. So the example here leaves font-weight values up to 400 untouched, but weights from 500 up have an extra 100 added to them; for font-stretch, the default (100%) value is untouched, but both narrower and wider values are brought closer to the middle of the range.

If the given base-family is not available, the rule is just ignored.

Using such an `@`-rule, an author can tweak the weight, stretch, size, etc., of a standard font to more closely match a webfont that will eventually be used, and then add the "adjusted" family as fallback for the `font-family` property.

(This is currently just a sketch of an idea, not worked out in detail; comments welcome.)


-- 
GitHub Notification of comment by jfkthame
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/126#issuecomment-764641927 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 13:28:06 UTC