2013-03-12 50 views
0

我需要一些解决方案或建议在网站中加载更快的字体。font-face加载速度更快?

@font-face { 
    font-family: 'myfont'; 
    src: url('myfont.eot'); 
    src: url('myfont.eot?#iefix') format('embedded-opentype'), 
     url('myfont.woff') format('woff'), 
     url('myfont.ttf') format('truetype'), 
     url('myfont.svg#nexa_heavyregular') format('svg'); 
    font-weight: normal; 
    font-style: normal; 
} 

需要一些时间来改变字体面,而HTML加载或下载的字体面的网址,一些想法更快加载它?

+0

更快的上行链路?从CDN加载? – 2013-03-12 14:46:57

回答

2

,而你的字体面加载使用FontLoader你不能让它加载速度更快,因为它依赖于网络和浏览器字体渲染,但你可以显示某种类型的负载指示:

// Show an activity indicator while font is loading... 

var fontLoader = new FontLoader(["myfont"], { 
    "fontsLoaded": function(error) { 
     // Hide the activity indicator and show the text. 
    } 
}, 3000); 
fontLoader.loadFonts(); 

这里是一个演示jsFiddle