@font-face使用思源黑体的问题:“Failed to decode downloaded font”

问题如下:
当使用从Google官网下载的NotoSansCJKsc-hinted字体包(109M)和github上下载的source-han-sans-sc字体包,如下:
clipboard.png
clipboard.png

CSS:

@font-face{
    font-family: 'NotoSansSC';
    src:url(fonts/NotoSansHans-Regular.otf) format('opentype');
    font-weight: 400;
}
.NotoSansCJKsc p{
    font-family: NotoSansCJKsc;
}
@font-face{
    font-family: 'SourceHanSansSC';
    src:url(fonts/SourceHanSansSC/SourceHanSansSC-Regular.otf) format('opentype');
    font-weight: 400;
}
.SourceHanSansSC p{
    font-family: SourceHanSansSC;
}

在chrome中测试发现以下错误:

Failed to decode downloaded font: http://127.0.0.1:8080/Test/css/fonts/NotoSansCJKsc/NotoSansCJKsc-Regular.otf
fonts.html:1 OTS parsing error: CFF : failed to parse table
fonts.html:1 Failed to decode downloaded font: http://127.0.0.1:8080/Test/css/fonts/SourceHanSansSC/SourceHanSansSC-Regular.otf
fonts.html:1 OTS parsing error: CFF : failed to parse table

图片描述

不知道有没有人遇到这个问题,如何解决?

注: 我在网上下载了另一个版本的NotoSans(48M左右),却没有报错。
字体文件:
clipboard.png
测试结果:
clipboard.png

阅读 23.6k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进