W3C home > Mailing lists > Public > public-css-archive@w3.org > March 2021

[csswg-drafts] [css-fonts] extent font-size-adjust to take a pair of values: <metric> <number> (#6160)

From: jfkthame via GitHub <sysbot+gh@w3.org>
Date: Tue, 30 Mar 2021 11:50:22 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-844423765-1617105021-sysbot+gh@w3.org>
jfkthame has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-fonts] extent font-size-adjust to take a pair of values: <metric> <number> ==

The idea of `font-size-adjust`, to take a meaningful metric for matching up the apparent visual size of disparate fonts, and harmonize it across whatever fonts end up getting used, is in principle a useful one. I think it has a few problems in practice, though:

(a) The meaning of the value is obscure; the ratio of ex-height to font size is not a number that designers are generally thinking about. `font-size-adjust: 0.5` sounds like it would halve the size of the font, but that's not at all what it does.

(b) It's difficult to come up with the appropriate value, even once its meaning is understood; you either have to dig around in font metrics to calculate it, or go by trial and error. We should have an `auto` value that gets the ex-height from the first available font, and then harmonizes everything else with it. (This has been proposed in #5539.)

(c) The big flaw is of course its Latin-centric nature; it is relying on a metric that isn't meaningful for most of the world's writing systems, and is unlikely to be set in a usefully equivalent way across lots of non-Latin fonts. We need alternatives that make sense for Arabic, Devanagari, Chinese, Mongolian, etc., etc.

So I propose we extend `font-size-adjust` to take two values, a ’metric’ and a number.

The ’metric’ value lets the author specify which of a number of font metrics is to be harmonized, instead of only allowing ex-height. So you could say

    font-size-adjust: ascent 0.8;

and the browser would adjust the sizing of all fonts to have an ascent value equal to 0.8em. Some other possibilities:

    font-size-adjust: ex-height 0.45; /* like current font-size-adjust behavior */
    font-size-adjust: cap-height 0.6; /* use cap-ht rather than ex */
    font-size-adjust: descent 0.3; /* less commonly wanted, probably, but no reason not to expose it */
    font-size-adjust: extent 1.0; /* scale so that total of ascent+descent equals 1em */
    font-size-adjust: ic-width 0.9; /* ideographic character advance, as per the ic unit */
    font-size-adjust: average-width 0.5; /* questionable how reliable this is, but no harm in making it available */

For any of these, the value `auto` means to derive the value from the first available font; in practice I suspect this would often be the most sensible choice for the value:

    font-size-adjust: extent auto; /* match total extent to first available font */

It's still not clear to me how well this would work across writing systems with radically different designs; e.g. trying to visually harmonize a Nastaliq Urdu font with a Latin fallback (let alone with, say, a Thai or Tibetan face), it's unclear that there is any specific metric that will give ideal results. But I think it would give designers quite a bit more control, and even for purely Latin content it may sometimes be more useful to match, for example, cap-height rather than ex-height.

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

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 30 March 2021 11:51:15 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:42 UTC