Re: [csswg-drafts] [css-fonts-5] Dynamic text size (#3708)

@tabatkins Getting the whole font has its uses though. 

Most of the time, web authors will change the font, but there are situations where you want the website to look native (Electron Apps or PWAs). Then you sometimes don't want your dialogs, menus, or other component to look any different than system ones. I think that was the original intention of `font` back in CSS 2.1, and I believe it's that at some point in history. The only problem is there was nothing states for `body`; there was only `caption`, `icon`, `menu`, `message-box`, `small-caption`
and `status-bar`. There was no dedicated value for just the regular font. There's also the case what `font-family` has no specification. It's up to the user-agent. For example, Chrome on Mac OS X defaults to `font-family:Times` and not the system font. Nothing in the W3 spec says `font-family` should initialized as `Times`, and yet, here we are.

https://drafts.csswg.org/css-fonts-3/#propdef-font-family

At least we now have `font-family: system-ui` which is part of CSS Font-4. That formalized a solution and did away with people having to use `font-family: -apple-system`.

https://drafts.csswg.org/css-fonts-4/#valdef-font-family-system-ui

While `font` is a big sledgehammer to the problem, it can easily be reset back however you'd like. In fact, by using the Apple's proprietary value, you are subject to whatever Apple decides to change about the font in future. You should be overriding it anyway.  You can easily override anything you don't want to be used in the next line after the declaration, like so:

````
html {
  font: system;
  /** Reset everything else **/
  font-style: initial;
  font-variant: initial;
  font-weight: initial;
  font-stretch: initial;
  /** font-size: initial; **/
  line-height: initial;
  font-family: initial;
}
````

Personally, I would override everything but `font-size`. There's also the case where the system `font-variant` may be useful. I think East-Asian languages have stronger benefit from this. Also if somebody wants to write a Web App (PWA) that would let somebody use that funky italic font on their Samsung if it's the system default, then they can. 😆 

But just to reiterate, the current specification (in CSS Fonts 4) for `font`'s `value` is :

`[ [ <font-style> || <font-variant-css2> || <font-weight> || <font-stretch-css3> ]? <font-size> [ / <line-height> ]? <font-family> ] | caption | icon | menu | message-box | small-caption | status-bar `

If it were:

`[ [ <font-style> || <font-variant-css2> || <font-weight> || <font-stretch-css3> ]? <font-size> [ / <line-height> ]? <font-family> ] | caption | icon | menu | message-box | small-caption | status-bar | system `

I'll be happy.

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

Received on Thursday, 28 March 2019 17:20:36 UTC