@ font-face在IE10上本地工作,但不在服务器上 [英] @font-face works locally on IE10, but not on the server
问题描述
我检查过并且字体文件在服务器上:
I checked and the font files are on the server:
@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。
What's weird is that the font is showing correctly in IE8, but not IE9 or 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:
And my .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和我得到这个消息:
I just checked in IE and I am getting this message:
CSS3114: @font-face failed OpenType embedding permission check. Permission must be Installable
推荐答案
尝试删除此部分: / p>
Try to remove this part:
local('☺')
或在此部分中添加其他字体,如
Or add the rest of fonts in this part too, like
src: local('☺'),
url('GraublauWeb.woff') format('woff'), url('GraublauWeb.ttf') format('truetype');
您可以确认服务器上也有这些字体吗?
And can you confirm you have all these fonts on server too?
尝试使用此工具来创建yout字体:
http://www.fontsquirrel.com/tools/webfont-generator
Try to use this tool to create yout fonts: http://www.fontsquirrel.com/tools/webfont-generator
选择expert控制选项并从EOT压缩更改为EOT Lite
Select the 'expert' control option and change from 'EOT Compressed' to 'EOT Lite'
这篇关于@ font-face在IE10上本地工作,但不在服务器上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!