Loading fonts from Google web font directory

孤街浪徒 提交于 2019-12-11 03:57:10

问题


Google explain a number of techniques for using their web fonts in this article

They present two methods:

  • use webfont.js
  • use an API key and google.load

I already use an API key to load jquery and it seemed like the best way to go about it when I read the following line:

"if you are already using the Google's AJAX APIs, then use the [google.load technique]"_

BUT they go on to say that:

"the first method [webfont.js technique] is quicker"

Q1

They say that the webfont.js method is quicker but advise me to use the slower method on the grounds that I'm already using it to load other files from their network. Should I ignore their advice as a simple mistake on their part and use the faster method?

Q2

Is there any benefit to using either of these techniques over the following when I'm not interested in writing javascript callbacks?:

<link href='http://fonts.googleapis.com/css?family=Luckiest+Guy' rel='stylesheet' type='text/css'>

回答1:


The advantage to the Google font loader is that it loads the fonts asynchronously in parallel with the rest of the page. Without an asynchronous approach, it is possible to block other assets while awaiting the loading of the fonts.



来源:https://stackoverflow.com/questions/4759007/loading-fonts-from-google-web-font-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!