我仍然有一个问题,即本地安装的webfonts无法通过@font-face声明加载,但外部webfonts (Google)运行良好。
没有意义的是,我的font-face声明中使用的语法与Google的WebFont声明相同,但似乎不起作用。
下一步当然是验证本地字体文件的路径是否正确。复制和粘贴@font-face声明中使用的URL会导致字体文件被下载到我的计算机上,因此路径必须是有效的。
我也检查了字体文件的权限。这些都被设置为0755,我相信这应该足以让任何浏览器阅读。
一些背景资料;这是一个运行Ubuntu 14.04和nginx作为后端的web服务器。
CSS@font-face {
font-family: 'BebasNeueRegular';
font-style: normal;
font-weight: normal;
src: url(http://gprejects.com/forum/styles/BBOOTS/theme/font/bebasneue/BebasNeue-webfont.eot?#iefix) format('embedded-opentype'), url(http://gprejects.com/forum/styles/BBOOTS/theme/font/bebasneue/BebasNeue-webfont.woff) format('woff'), url(http://gprejects.com/forum/styles/BBOOTS/theme/font/bebasneue/BebasNeue-webfont.ttf) format('truetype'), url(http://gprejects.com/forum/styles/BBOOTS/theme/font/bebasneue/BebasNeue-webfont.svg#BebasNeueRegular) format('svg');
}
h1, h2, h3, h4, h6, h1 a, h2 a, h3 a, h4 a, h6 a {
color: #333333;
font-family: 'BebasNeueRegular','Oswald','Arial','Helvetica',sans-serif;
font-weight: 200;
line-height: normal;
margin: 0 0 10px;
-webkit-font-smoothing: antialiased;
}
请注意,Oswald是一个Google WebFont,并且作为回退可以正常工作,并且与@font-face声明相同的CSS文件中的其他所有内容也可以正常工作。
在Chrome检查器中,我没有看到任何调用正在获取任何BebasNeue字体文件。您确定该页面正在加载BebasNeue的字体族定义