-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If applied to a selector, what's the behaviour? #10
Comments
Also: .whatever {
font-rendering: mandatory 60s;
font-family: foo, bar;
} Assuming |
For the first case: not claiming to be a CSS expert but my take is that foo renders at 5s, bar renders at 10s, blah renders immediately since it's using a "readily" available system font. For the second case, here is my take:
cc/ @tabatkins |
Makes sense to me! There isn't a way to say "render no text here until all the fonts have downloaded", but maybe we don't need that. |
It seems like a reasonable use case. I think we can change the model and allow for that. Intuitively, it would be similar to getting a bunch of font promises and waiting until all of them satisfy the condition, and if any one fails to complete within specified timeout, then entire set fails.
If you don't want A and B to depend on each other, then move the font-rendering declaration further down the selector tree... WDYT? |
Yeah, that works. There are nuances around cases where B isn't needed, but don't think it gets in the way. |
Thinking about this some more... there may be some odd edge cases around this sort of pattern. For example, say I have parent selector that triggers a font fetch and the timer is running.. then, I trigger a display property on another child selector that now needs another font -- does the outer timer stay the same, get reset, etc? These are solvable cases, but seems like implementation might get a bit hairy... It would probably be much simpler to stay with "each font is on its own" semantics, and if you need grouping, then use Font Loading API. Worth thinking about the use cases vs complexity... |
I would prefer that the CSS approach stays simple (font loading API should be the better choice for more advanced use cases). |
👍 for simple. |
The way I just defined it in http://tabatkins.github.io/specs/css-font-rendering/ is that each font face comes with a timer that starts when the UA first attempts to use it. Whether a given element using the font considers itself blocked, swappable, or stuck depends on its individual 'font-rendering' values, compared against the font's timer. The 'font-rendering' descriptor in the @font-face itself just provides a default for any element that doesn't manually specify things. For more complicated things, definitely just use the Font Loading API. |
Assuming:
foo
&bar
are defined in@font-face
rulesfoo
takes 5 seconds to loadbar
takes 10 seconds to loadfont-rendering
in.whatever
has precedence over rules in@font-face
)When does the text in
.foo
render? As in, does it also wait forbar
asfont-rendering
is set on a parent that uses both fonts? What about the text in.blah
?The text was updated successfully, but these errors were encountered: