我检查了字体文件在服务器上:
@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