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

Moh*_*mad 4 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
Run Code Online (Sandbox Code Playgroud)

我的 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;
}
Run Code Online (Sandbox Code Playgroud)

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

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

Moh*_*mad 5

我发现问题了,我用Filezilla上传字体到服务器,设置为ASCII传输模式,切换到二进制重新上传字体问题解决了。