从谷歌的网页字体或自己的服务器的字体加载字体,哪一个更高效的页面加载时间? [英] Loading font from google web fonts or fonts from own server, which one is more efficient in terms of page load time?

查看:208
本文介绍了从谷歌的网页字体或自己的服务器的字体加载字体,哪一个更高效的页面加载时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用一些自定义字体时,我有两个选项,可以从我自己的服务器加载表单,也可以加载Google网页字体。但我担心哪一个页面加载时间有效率?



我使用css的方式是

  @ font-face {
font-family:'MyWebFont';
src:url('webfont.eot'); / * IE9兼容模式* /
src:url('webfont.eot?#iefix')格式('embedded-opentype'),/ * IE6-IE8 * /
url('webfont.woff ')格式('woff'),/ *现代浏览器* /
}

在这里,在加载字体的同时,我也在使用字体版本的缓存,并从CDN加载字体。



试图加载大小接近36k。

  h1 {
font-family: 'MyWebFont',Fallback,sans-serif;

code


谷歌字体的实现

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

h1 {
font-family:'Caesar Dressing',cursive;





$ b

有人可以帮我理解哪一个应该使用google web字体或自定义表单自己的服务器在页面加载时间哪一个是最好的?

解决方案

从谷歌cdn下载字体总是会更快,如果不是你(如果你在服务器上的话),对于其他人来说,简单的理由是,google的cdn服务器可能会更接近他们,而不是你的服务器。



另外,如果你想要更进一步的话,谷歌还会在其cdn上提供其他一些有用的东西,甚至可以从上面列出的相同优点获得jquery。

b
$ b

 < script src =http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js >< /脚本> 


While working with some custom fonts, I have two options either I can load a form from my own server or I can load a google web fonts. But my concern is which one efficient in terms of page load time?

The way I am using css is

@font-face {
    font-family: 'MyWebFont';
    src: url('webfont.eot'); /* IE9 Compat Modes */
    src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('webfont.woff') format('woff'), /* Modern Browsers */
    } 

Here, while loading font, I am also using cacheing using font version and loading the fonts from CDN.

The font which I am trying to load is near by 36k in terms of size.

h1 {
       font-family: 'MyWebFont', Fallback, sans-serif;
}

Implementation of google fonts

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

h1{
  font-family: 'Caesar Dressing', cursive;
}

Can someone please help me to understand which one should be used either google web fonts or custom form own server. In terms of page load time which one is best ?

解决方案

Downloading the fonts from the google cdn is always going to be faster, if not for you (in the case where you're in lan with your server), for everyone else for the simple reason that the google cdn servers will probably be much closer to them rather than to your server.

Also, if you want to go even further google also hosts a couple of other useful things on their cdn, you can even get jquery from them with the same advantages listed above.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

这篇关于从谷歌的网页字体或自己的服务器的字体加载字体,哪一个更高效的页面加载时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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