CSS @font-face 未通过 OpenType 嵌入权限检查。权限必须是可安装的

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29338479/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 03:08:13  来源:igfitidea点击:

@font-face failed OpenType embedding permission check. Permission must be Installable

cssfontsfont-face

提问by Jakub Holovsky

This exception occurs in here.You can reproduce it in IE11. So far I have not found the cause of the issue. Any ideas why this is being caused?

这个异常发生在这里。您可以在 IE11 中重现它。到目前为止,我还没有找到问题的原因。任何想法为什么会这样?

enter image description here

在此处输入图片说明

CSS3114: @font-face failed OpenType embedding permission check. Permission must be Installable. File: 53d9eae5-63b4-48d7-a5b8-3419455028bb.ttf

CSS3114:@font-face 未通过 OpenType 嵌入权限检查。权限必须是可安装的。文件:53d9eae5-63b4-48d7-a5b8-3419455028bb.ttf

The web site is running on Azure Websites platform and is using ASP.NET MVC 5.

该网站在 Azure 网站平台上运行,并使用 ASP.NET MVC 5。

采纳答案by Jakub Holovsky

Fixed by adding

通过添加固定

<staticContent>
  <mimeMap fileExtension=".woff" mimeType="application/octet-stream" />
</staticContent>

under

在下面

 <system.webServer>

in web.config.

在 web.config 中。

Edit:

编辑:

to prevent any problems with consequent releases I recommend doing this:

为防止后续版本出现任何问题,我建议这样做:

<staticContent>
      <remove fileExtension=".woff" />
      <mimeMap fileExtension=".woff" mimeType="application/octet-stream" />
</staticContent>

回答by Martin

sibaspage answer pointed me into the right direction. But I still see the error message in IE11. For me it worked using the following syntax:

sibaspage 的回答为我指明了正确的方向。但我仍然在 IE11 中看到错误消息。对我来说,它使用以下语法工作:

@font-face {
   font-family: 'Font-Name';
   src: url('../fonts/Font-Name.eot?#iefix') format('embedded-opentype'),
        url('../fonts/Font-Name.ttf')  format('truetype');
}

回答by entoniperez

Another solution can be change the Font embeddabilityproperty file. Right click and see Detailstab:

另一种解决方案是更改字体可嵌入性属性文件。右键单击并查看详细信息选项卡:

enter image description here

在此处输入图片说明

If this property does not appear, you can use this serviceto add it. It only works for .ttffont files. But I guess there are some other services to change other font file extensions.

如果这个属性没有出现,你可以使用这个服务来添加它。它仅适用于.ttf字体文件。但我想还有一些其他服务可以更改其他字体文件扩展名。

回答by davidrl1000

For documentation or future visitors: In my case I was experimenting this issue with IE11and .otffonts, if this is your case read this Can I use case. Basically what it says is that IE11 doesn't support some .ttf and .otffonts.

对于文档或未来的访问者:在我的情况下,我正在用IE11.otf字体试验这个问题,如果这是你的情况,请阅读这个Can I use case。基本上它说的是IE11 不支持某些 .ttf 和 .otf字体。

The best solution I found was to convert the .otf font to .woffand add the code on Jakub Holovsky's response with a small change.

我找到的最佳解决方案是将 .otf 字体转换为 .woff并在 Jakub Holovsky 的响应中添加代码,并稍作改动。

<staticContent>
  <remove fileExtension=".woff" />
  <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
</staticContent>

回答by Clay Sissing

@font-face {
    font-family: 'Gotham-Medium';
    src: url('fonts/Gotham-Medium.eot');
    src: local('?'), url('fonts/Gotham-Medium.woff') format('woff'), url('fonts/Gotham-Medium.ttf') format('truetype'), url('fonts/Gotham-Medium.svg') format('svg');
    font-weight: normal;
    font-style: normal;
}

Notice src: local('?'),

注意src: local('?'),

回答by Aishwarya Ramesh

I had the same problem and found this article: https://creativemarket.com/blog/the-missing-guide-to-font-formats. You can just add the relevant fonts to your font-face.

我遇到了同样的问题,找到了这篇文章:https: //creativemarket.com/blog/the-missing-guide-to-font-formats。您可以将相关字体添加到您的字体中。

回答by sibaspage

IE not supports .ttf just use .eot font files

IE 不支持 .ttf 只使用 .eot 字体文件

@font-face {
  font-family: 'Font-Name';
  src: url('../fonts/Font-Name.eot?#iefix') format('embedded-opentype');
  src: url('../fonts/Font-Name.ttf')  format('truetype');
}