我在使用完全相同的字体时遇到了同样的问题。当谷歌地图加载他们的字体时,我以前的所有样式都改变了。我决定使用简单的解决方案。当您有您的网络字体链接时,例如:
<link href='http://fonts.googleapis.com/css?family=Roboto:300&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
它产生:
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'),
url(http://themes.googleusercontent.com/static/fonts/roboto/v10/Pru33qjShpZSmG3z6VYwnT8E0i7KZn-EPnyo3HZu7kw.woff) format('woff');
}
如您所见,它具有 font-family 属性。例如,我决定将其更改为“RobotoL”:
@font-face {
font-family: 'RobotoL';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'),
url(http://themes.googleusercontent.com/static/fonts/roboto/v10/Pru33qjShpZSmG3z6VYwnT8E0i7KZn-EPnyo3HZu7kw.woff) format('woff');
}
然后在你的文档中使用它,例如:
body {
font-family: 'RobotoL';
font-weight......
}
那么就没有必要使用谷歌生成的导入或链接,而是自己编写。 3.14版以后不再有Google Maps Roboto字体问题了)
在 Google 插入这个长长的 .woff url 后,提取它只有一个棘手的部分,但您可以使用每个现代浏览器开发工具(Firebug 等)轻松完成。我认为它也适用于 Condensed 和其他 Roboto 版本。