- From: Lea Verou via GitHub <sysbot+gh@w3.org>
- Date: Tue, 09 Feb 2021 14:43:10 +0000
- To: public-css-archive@w3.org
Yet another vote on the prominence of the use case. I always apply tight letter-spacing to bold Helvetica, which looks bad with a fallback font. Here's another idea, with minimal syntax additions and no new microsyntaxes or tweaks to individual property grammars: We have already more or less resolved to add inline conditionals (#4731, #5009) with IACVT behavior whenever needed. What if we add a keyword that resolves to the currently used `font-family`? E.g. `currentFontFamily` or `current-font-family` or `current(font-family)` (TBB). Similarly to `em` values and `currentColor`, it would resolve as the *inherited* current font-family on the `font` and `font-family` properties, to prevent cycles. Then authors can write conditionals to their heart's content, to do things as simple or as complex as they wish. E.g. the example from above: ```css font-weight: 400 "Helvetica" 500 "Times" 300; ``` would be written as: ```css font-weight: if(current(font-family) = "Helvetica", 400, if(current(font-family) = "Times", 500, 300)); ``` Or even, just for the lulz: ```css font-weight: calc(300 + if(current(font-family) = "Helvetica", 100, 0) + if(current(font-family) = "Times", 200, 0)); ``` This provides maximum flexibility, while still allowing simple cases to remain simple. It can get a little repetitive when you need to vary many properties by the same condition, but that can be addressed via preprocessors until it's addressed more generally in CSS. Furthermore, this means the syntax would benefit from any future improvement to conditionals, e.g. `switch()` or block conditionals. -- GitHub Notification of comment by LeaVerou Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/126#issuecomment-775990597 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 9 February 2021 14:43:12 UTC