Re: [csswg-drafts] [css-fonts] Proposal to expose font metrics (#4780)

> Also note #838 for stroke widths.

@Crissov I could see that being quite useful as well!

> > ```css
> > font(--x-height)
> > ```
> 
> Which font does this refer to?

@litherum It would target the currently-used font. I imagine that would be the best way to go about it.

Say you had a rule for paragraphs such as `font-family: Source Sans Pro, Arial;`, the former font loaded from Google Fonts. If the font successfully loaded, the exposed metrics would be for Source Sans Pro, but if it failed and the browser fell back to Arial, the metrics for Arial would be exposed instead.

This way, if you were providing some alignment, you would always have values that are consistent with the font, and not hardcoded based on the best-case scenario.

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

Received on Wednesday, 19 February 2020 02:36:03 UTC