-
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
font-desirability: optional, progressive, mandatory #5
Conversation
igrigorik
commented
Sep 25, 2014
- optional, progressive, mandatory rendering strategies
- added CSS highlighting, fixed examples, other minor stuff
- wording improvements - replace "readily available" with "first text-paint-time" - fix "timeout" -> "font-timeout" in examples - add CSS highlighting
I don't understand the point of splitting "optional" into "optional" and "progressive". In a private email thread, you hinted that this was an attempt to solve the "you might have the font, but it might still be tens of milliseconds away" problem, but I don't see how it has anything to do with that. As written, it seems to just provide the exact functionality already given by using a mix of |
css-font-timeout | ||
================ | ||
A proposal for CSS to let web developers control font timeout. | ||
## css-font-timeout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you converting this to an h2, and lowering all the other headings a level as well?
The key observation here is that there is no way for a developer to guess the right timeout value if their goal is to deliver a consistent+optimal first text-render experience: some cache and local() lookups can take north of 100 milliseconds; network fetches might take anywhere from low tens to thousands of milliseconds; different browsers on different hardware will parse and layout page content with different speeds. It's a crapshoot. That said, the actual problem we're trying to address is: at some point the browser is ready to layout and render content that includes text pixels, what strategy should it pick? The With that in mind,
Note that |
Oh, I see! If the browser knows it needs a font, but it doesn't yet need it to actually lay anything out, then an "optional" value would let it be used; if it needs a font but needs to lay out before the font arrives, "optional" will have it use the fallback instead, while "progressive" makes it swap out for the desired font when it arrives. These names need some work, in that case. These are really two orthogonal concerns:
Because the first covers the second, it looks like it can be arranged into three values, but I think that obscures things. I prefer something like:
The presence/absence of the "swap" keyword controls what happens at the end of the timeout (question 2). The 'font-optional' property controls what happens when the browser first discovers it needs a font it doesn't have (question 1). Also, it uses easier-to-spell words. ^_^ That's not a minor thing; "desirability" trips up my fingers every time I try to type it, and I'm an excellent speller; it's just a clumsy word to type. (Regarding your last paragraph, I was pretty sure that local/url was indeed not what was being covered here, but the text you're proposing doesn't make that clear.) |
You're right, I'm conflating orthogonal concerns. But, it seems like font-timeout + swap does as well because font request end-time is not always equal to font timeout. We have three different conditions / points in time to consider:
What if we map the three to these properties:
Default (Chrome) behavior is:
WDYT? |
I still think this is overcomplicated, but I agree that my previous carving up was suboptimal. Let's revisit the use-cases:
Is this all of them? Is there anything else? Given these three, I think we can simplify significantly. The difference between 1 and 2 is what to do before the font loads/the timeout expires: show nothing or show a fallback. The difference between 2 and 3 is that 3 sets the timeout value to "when you start actually rendering the affected text". So, let's try just handling those directly: font-rendering: optional | swap <time> | mandatory <time> This covers the three use-cases directly, and only exposes a timeout for the cases that need it. If we really feel like it, we can pull the timeout out into a separate descriptor, even though it doesn't apply to Importantly, this also means that authors don't have to think about combinations and what different properties do in difference circumstances. They just have three easy-to-explain cases, and can choose which one they want. |
@tabatkins I like it! Much simpler, and covers all the necessary cases. Updated the pull, PTAL: https://github.com/igrigorik/css-font-timeout/blob/patch-1/README.md |
Oops, I missed marking the s as optional. They should be omittable, and default to, I dunno, 3s? |
Ah, right, good call. Updated to use 3s as default. |
This makes sense, since both are Chromium-based.
Opera matches Chrome
Update README.md
font-desirability: optional, progressive, mandatory