2013-03-12 83 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