Comments on: New, improved embed code https://blog.typekit.com/2012/07/19/new-improved-embed-code/ News about Typekit Fri, 20 Jul 2012 17:14:52 +0000 hourly 1 https://wordpress.org/?v=5.4.1 By: Faruk Ateş (@KuraFire) https://blog.typekit.com/2012/07/19/new-improved-embed-code/#comment-3329 Fri, 20 Jul 2012 17:14:52 +0000 http://blog.typekit.com/?p=7495#comment-3329 In reply to Faruk Ateş (@KuraFire).

Hey Sean, it seems the issue was caused by YepNope’s async loading. When I switched to the Typekit async code (and moved it way up to right after Modernizr), it no longer experienced a FOUT.

]]>
By: Sean McBride https://blog.typekit.com/2012/07/19/new-improved-embed-code/#comment-3328 Fri, 20 Jul 2012 15:37:59 +0000 http://blog.typekit.com/?p=7495#comment-3328 In reply to Tim Swan (@tim_swan).

Tim: Just to clarify, the asynchronous embed code doesn’t necessarily make it easier to hide the FOUT. Font events are available when using both the default and advanced embed code styles, so you should be able to eliminate flashy text no matter what.

]]>
By: Sean McBride https://blog.typekit.com/2012/07/19/new-improved-embed-code/#comment-3327 Fri, 20 Jul 2012 15:35:42 +0000 http://blog.typekit.com/?p=7495#comment-3327 In reply to Faruk Ateş (@KuraFire).

Faruk: I’m curious about the delay in font events that you’re seeing with the async code. None of the JS font event callbacks will trigger until the initial JS is finished downloading and executing, but the “wf-loading” CSS font event classname should be applied to the html element immediately when the embed code executes. If the embed code is in the head of your page, that should be before the browser gets a chance to render any part of your page. So, if you have CSS that hides elements with web fonts while “wf-loading” is present, there should be absolutely no FOUT visible, even though you’re using async loading.

Were you trying to use the JS callbacks instead of the CSS classnames, perhaps? Or were you using some other library or tool that was somehow delaying execution of the embed code?

]]>
By: Matthias Jakel https://blog.typekit.com/2012/07/19/new-improved-embed-code/#comment-3326 Fri, 20 Jul 2012 08:06:17 +0000 http://blog.typekit.com/?p=7495#comment-3326 There is still room for optimization. I would appreciate to help you with further improvements.

]]>
By: Tim Swan (@tim_swan) https://blog.typekit.com/2012/07/19/new-improved-embed-code/#comment-3325 Fri, 20 Jul 2012 07:03:50 +0000 http://blog.typekit.com/?p=7495#comment-3325 Excited to implement the asynchronous code on the blog. No flashy text!

]]>
By: Faruk Ateş (@KuraFire) https://blog.typekit.com/2012/07/19/new-improved-embed-code/#comment-3324 Fri, 20 Jul 2012 06:27:13 +0000 http://blog.typekit.com/?p=7495#comment-3324 In reply to Faruk Ateş (@KuraFire).

Update on this: I think the slowdown is exacerbated when using YepNope, as I see a much more significant flash/delay when doing so. Using Typekit’s own native embed code works a lot better. Since this was not a reduced test case, I can’t quite be conclusive either way. However, I am posting this here to correct my earlier statement—it was *not* the asynchronous loading (alone?) that caused the problem.

]]>
By: Faruk Ateş (@KuraFire) https://blog.typekit.com/2012/07/19/new-improved-embed-code/#comment-3323 Fri, 20 Jul 2012 01:11:51 +0000 http://blog.typekit.com/?p=7495#comment-3323 The asynchronous embed was causing issues on modernizr.com, having the font events trigger too slow and, as a result, browsers would start to render something only to then undo it.

If you aren’t trying to have no FOUT, the async is great, but if you *are* trying to hide text until the fonts have loaded, I recommend not using async. Fast machines + fast browsers will be too fast for your code. 🙂

That said, modernizr.com is now using the new embed code. Hooray! (it also got some other much-needed improvements.)

]]>
By: Zachary Kain ☯ (@zakkain) https://blog.typekit.com/2012/07/19/new-improved-embed-code/#comment-3322 Thu, 19 Jul 2012 21:53:27 +0000 http://blog.typekit.com/?p=7495#comment-3322 This is great, I’ll be very glad to use the new async-embed and reap the performance benefits! Thanks!

]]>
By: Don https://blog.typekit.com/2012/07/19/new-improved-embed-code/#comment-3321 Thu, 19 Jul 2012 21:37:13 +0000 http://blog.typekit.com/?p=7495#comment-3321 Love the async code. Thank you!

]]>
By: Sumit https://blog.typekit.com/2012/07/19/new-improved-embed-code/#comment-3320 Thu, 19 Jul 2012 21:21:26 +0000 http://blog.typekit.com/?p=7495#comment-3320 Thanks Typekit!

]]>