从Google网络字体目录加载字体 [英] Loading fonts from Google web font directory

查看:285
本文介绍了从Google网络字体目录加载字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google在这篇文章中解释了许多使用其网络字体的技术

他们提出了两种方法:

  • 使用 webfont.js
  • 使用 API密钥 google.load
  • use webfont.js
  • use an API key and google.load

我已经使用API​​密钥加载jquery,当我阅读以下行时,这似乎是解决该问题的最佳方法:

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:

"如果您已经在使用Google的AJAX API,请使用[ google.load 技术]" _

但是,他们继续说:

"第一种方法[webfont.js技术]是快速"

第一季度

他们说webfont.js方法比较快,但是建议我使用较慢的方法,因为我已经在使用它从他们的网络中加载其他文件.我是否应该忽略他们的建议,将其视为一个简单的错误,并使用更快的方法?

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?

当我对编写JavaScript回调不感兴趣时​​,使用以下两种方法中的 有什么好处吗?

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'>

推荐答案

Google字体加载器的优点在于,它与页面的其余部分并行地异步加载字体.如果没有异步方法,则有可能在等待字体加载时阻止其他资产.

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.

这篇关于从Google网络字体目录加载字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆