I want CSS to have access to font metrics

Submitted by Christopher Kirk-Nielsen

There are a lot of typography-related properties in CSS, but we are still far from what can be done in print. For instance, we rely on hacks to clean up the start/end of a paragraph's ascender/descender space for optical alignment. It would be useful to expose some font metrics to CSS to be able to adjust this in a clean way:

h1 {
margin-top: calc(font(--x-height) - font(--ascender-height) );
}

Imagine the possibilities with a font function similar to custom properties or environment variables!

Tagged
CSS