-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Intent to implement: Font loading control in AMP #648
Comments
This will be a builtin, right? |
No, since it does not actually trigger the font load performance is not critical I think. |
But timeout will be since "amp-font" loaded? Or since runtime started? |
Also, maybe |
@cramforce @font-face { or should i get the url as an attribute in ? |
To confirm, we are not directly downloading |
Yes, what @dvoytenko says: This is not about triggering font loads, just controlling their effect on the page.
|
Implement an API for controlling timeouts on font loading. Currently most browsers time out after 3 seconds but Safari never times out.
The new
amp-font
tag allows adding and removing CSS classes fromdocument.documentElement
based on whether a font was loaded or is in error-state.The tag observes loading of a font and when it loads executes the optional attributes
on-load-add-class
andon-load-remove-class
and when there is any error or timeout runson-error-remove-class
andon-error-add-class
.Using these classes authors can guard whether a font is displayed and get the following results:
Implementation:
I believe this is the best article on the topic: https://dev.opera.com/articles/better-font-face/ and this is the best / smallest library: https://github.com/zachleat/fontfaceonload
CC @pbakaus
The text was updated successfully, but these errors were encountered: