Measures depending on used font (was: A CSS equivalent of HTML's DOCTYPE trigger)

Matthew Wilcox (2012-01-10 09:28):

> The issue in there was that type measures (the margin, padding etc we apply to elements that have text in them) should be adjusted depending on the actual typeface in use. We currently set them as concrete values based on the preferred font, but if that font isn't available then the next in the font stack is unlikely to be suitably close and therefor the measures need adjusting. CSS doesn't have that type of logic or workflow.

Honestly, I don’t think it would be worth it. People who care about typographic details like this will usually provide the preferred font via ‘@font-face’ and set ‘em’-based measures accordingly. With that designers can almost almost pretend that webpages were static media. The fallback fonts, properly adjusted by ‘font-size-adjust’ and carefully chosen to have similar metrics, are just that, a fallback, which doesn’t need the highest level of fine-tuning.

Anyhow, what would you imagine the syntax to be like?

  foo {
    font-family: Helvetica, Arial, sans-serif;
    bar: 1em;/* fallback */
    bar: 1em @ Helvetica, 1.1em @ Arial;
  }
  baz {
    quuz: 2em;
    quuz: 2em @ Helvetica, 2.1em @ Arial;
  }

  foo {
    font-family: Helvetica, Arial, sans-serif;
    bar: 1em;/* fallback */
    bar: 1em !for(Helvetica);
    bar: 1.1em !for(Arial);
  }

Received on Sunday, 15 January 2012 12:30:20 UTC