2

我检查了字体文件在服务器上:

@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
4

3 回答 3

2

尝试删除这部分:

local('☺')

或者在这部分也添加其余的字体,比如

src: local('☺'),
url('GraublauWeb.woff') format('woff'), url('GraublauWeb.ttf') format('truetype');

你能确认你在服务器上也有所有这些字体吗?


尝试使用这个工具来创建你的字体: http ://www.fontsquirrel.com/tools/webfont-generator

选择“专家”控制选项并从“EOT 压缩”更改为“EOT Lite”

于 2013-06-17T22:10:26.803 回答
2

我在 IIS 服务器上遇到了同样的问题,最后意识到,我必须将 mime 类型的“woff”添加到 ISS,以便传递文件。其他浏览器好像支持其他文件类型,所以当他们无法访问woff时他们会使用其他文件类型,但ie11需要woff。

于 2014-07-11T09:39:40.440 回答
0

IIS-Server 8 之前的版本似乎没有默认添加 mime 类型“woff”。将其添加到列表中(服务器 > 您的站点 > mime-types),您应该没问题。这至少为我解决了 IE 11 中的 CSS3114 错误。FF 和 Chrome 从来没有遇到过问题,因为它们在这一点上似乎没有那么严格。

于 2014-11-11T17:30:08.950 回答