如何修复“可下载字体:被消毒剂拒绝”

时间:2019-09-07 16:29:03

标签: html css fonts

我想在网页中使用字体,但是在加载页面时,我在Firefox中收到了以下错误消息:

downloadable font: rejected by sanitizer (font-family: "Yekan" style:normal weight:normal stretch:normal src index:1) source: .../css/Yekan.woff2  custom.css:1:12
downloadable font: incorrect file size in WOFF header (font-family: "Yekan" style:normal weight:normal stretch:normal src index:2) source: .../css/Yekan.woff  custom.css:1:12
downloadable font: rejected by sanitizer (font-family: "Yekan" style:normal weight:normal stretch:normal src index:2) source: .../css/Yekan.woff  custom.css:1:12
downloadable font: FFTM: invalid table offset (font-family: "Yekan" style:normal weight:normal stretch:normal src index:3) source: .../css/Yekan.ttf  custom.css:1:12
downloadable font: rejected by sanitizer (font-family: "Yekan" style:normal weight:normal stretch:normal src index:3) source: .../css/Yekan.ttf  custom.css:1:12
downloadable font: CFF : table overruns end of file (font-family: "Yekan" style:normal weight:normal stretch:normal src index:4) source: .../css/Yekan.otf  custom.css:1:12
downloadable font: rejected by sanitizer (font-family: "Yekan" style:normal weight:normal stretch:normal src index:4) source: .../css/Yekan.otf

我的custom.css文件:

@font-face {
    font-family: 'Yekan';
    src: url('./Yekan.eot');
    src: url('./Yekan.eot?#iefix') format("embedded-opentype"),
    url('./Yekan.woff2') format('woff2'),
    url('./Yekan.woff') format('woff'),
    url('./Yekan.ttf') format('truetype'),
    url('./Yekan.otf') format('opentype'),
    url('.//Yekan.svg#Yekan') format('svg');
    font-weight: normal;
    font-style: normal;
}

我的style.css(使用字体的地方):

body
{
   font-family: "Yekan";
}
  • 我已经搜索了很多,却找不到解决这个问题的方法。
  • 我以前使用过这种字体,但没有问题。
  • 我检查了模因类型并且它是正确的(例如Yekan.ttf的模因类型是application / x-font-ttf)。

1 个答案:

答案 0 :(得分:0)

我发现了问题,我使用Filezilla将字体上传到服务器,并且在切换到Binary并重新上传字体后解决了该问题,并设置为ASCII传输模式。