使用Google Web Fonts优先处理SVG字体

9po*_*nt6 25 svg google-chrome webfonts google-webfonts

除非您使用SVG字体,否则Windows上的Chrome浏览器中的font-face渲染非常糟糕.但是,谷歌网络字体优先考虑WOFF文件.

有没有办法强制它提供SVG字体或我是否必须自己手动托管字体?

Gaf*_*ffe 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');
}
Run Code Online (Sandbox Code Playgroud)

在本地托管文件后,您可以在堆栈中移动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');
}
Run Code Online (Sandbox Code Playgroud)

  • @GlauberRocha你可以使用Font Squirrel的[Webfont Generator](http://www.fontsquirrel.com/tools/webfont-generator)从TTF文件创建一个font-face工具包. (10认同)