【发布时间】:2014-11-12 01:30:08
【问题描述】:
我检查了,字体文件在服务器上:
@font-face {
font-family: 'DroidSerifRegular';
src: url('fontface/DroidSerif-Regular-webfont.eot');
src: url('fontface/DroidSerif-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('fontface/DroidSerif-Regular-webfont.woff') format('woff'),
url('fontface/DroidSerif-Regular-webfont.ttf') format('truetype'),
url('fontface/DroidSerif-Regular-webfont.svg#DroidSerifRegular') format('svg');
src: local('☺'),
url('fontface/DroidSerif-Regular-webfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'DroidSerifItalic';
src: url('fontface/DroidSerif-Italic-webfont.eot');
src: url('fontface/DroidSerif-Italic-webfont.eot?#iefix') format('embedded-opentype'),
url('fontface/DroidSerif-Italic-webfont.woff') format('woff'),
url('fontface/DroidSerif-Italic-webfont.ttf') format('truetype'),
url('fontface/DroidSerif-Italic-webfont.svg#DroidSerifItalic') format('svg');
src: local('☺'),
url('fontface/DroidSerif-Italic-webfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
编辑:奇怪的是字体在 IE8 中正确显示,但不是 IE9 或 IE10。
我也试过了:
@font-face {
font-family: 'DroidSerifRegular';
src: local('☺'),
url('http://www.mysite.ca/themes/mysite/fontface/DroidSerif-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('http://www.mysite.ca/themes/mysite/fontface/DroidSerif-Regular-webfont.woff') format('woff'),
url('http://www.mysite.ca/themes/mysite/fontface/DroidSerif-Regular-webfont.ttf') format('truetype'),
url('http://www.mysite.ca/themes/mysite/fontface/DroidSerif-Regular-webfont.svg#DroidSerifRegular') format('svg');
font-weight: normal;
font-style: normal;
}
还有我的 .htaccess:
AddType font/ttf .ttf
AddType font/eot .eot
AddType font/otf .otf
AddType font/woff .woff
<FilesMatch "\.(ttf|otf|eot|woff)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
另一个编辑:
我刚刚在 IE 中签入,我收到了这条消息:
CSS3114: @font-face failed OpenType embedding permission check. Permission must be Installable
【问题讨论】:
-
有时 url 必须采用文件的整个路径。
-
好点。我刚刚尝试过,但它仍然无法正常工作......它没有默认为网络字体......它看起来很奇怪,很瘦而且有别名。
-
你的服务器的 .htaccess 是什么样的(我假设你在 apache 上)。
-
我依稀记得遇到过类似的问题。如果我没记错的话,对我来说,字体文件实际上有问题。我不得不要求字体提供商(在我的例子中是 myfonts.com)为我重新生成字体文件。
-
奇怪的是它在我将文件上传到服务器之前(意思是,在我的计算机上本地)......?