2013-01-21 41 views
25

除非您使用SVG字體,否則在Google Chrome瀏覽器中進行字體表面渲染非常糟糕。但谷歌網頁字體優先WO WO文件。使用Google Web字體優先處理SVG字體

有什麼辦法強制它提供SVG字體,還是我必須自己手動託管字體?

回答

17

您需要將文件託管爲使用@import<link>方法引用僅調用WOFF文件(由於瀏覽器檢測)的CSS文件。防爆。 http://fonts.googleapis.com/css?family=Open+Sans

@font-face { 
    font-family: 'Open Sans'; 
    font-style: normal; 
    font-weight: 400; 
    src: local('Open Sans'), local('OpenSans'), url('http://themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff') format('woff'); 
} 

一旦託管文件在本地,然後你可以移動SVG調出棧確定其優先級。你可以在這裏看到一個例子:http://www.fontspring.com/blog/smoother-web-font-rendering-chrome

@font-face { 
    font-family: 'MyWebFont'; 
    src: url('webfont.eot'); 
    src: url('webfont.eot?#iefix') format('embedded-opentype'), 
    url('webfont.svg#svgFontName') format('svg'), 
    url('webfont.woff') format('woff'), 
    url('webfont.ttf') format('truetype'); 
} 
+0

感謝發佈這個,但在谷歌字體頁面我找不到如何下載各種格式的字體。我用Open Sans 400,400斜體,600,600斜體做了一個集合。當我將該集合下載爲zip文件時,只有TTF文件... –

+10

@GlauberRocha您可以使用Font Squirrel中的[Webfont Generator](http://www.fontsquirrel.com/tools/webfont-generator)從TTF文件創建一個字體工具包。 – Gaffe

+0

非常感謝@Gaffe。奇怪的是,因爲我似乎記得谷歌字體網站用來直接提供所有這些格式的下載。 –