IE 11:我自己的代码中出现错误 CSS3111,并且 google.com/fonts 不呈现任何字体 [英] IE 11: error CSS3111 in my own code, and google.com/fonts doesn't render any fonts

查看:9
本文介绍了IE 11:我自己的代码中出现错误 CSS3111,并且 google.com/fonts 不呈现任何字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个使用 Google 字体 Open Sans 的网站,如下所示:

<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700italic,800italic,800,700' rel='stylesheet' 类型='文本/CSS'>

通常,我在处理我的网站时使用 Chrome,但今天我决定看看它在 Windows 10 上的 IE 11 (11.0.10240.16431) 中的外观.不幸的是,Open Sans 没有被正确加载和渲染.我在开发者工具控制台中看到了很多这样的错误:

CSS3111:@font-face 遇到未知错误.PRmiXeptR36kaC0GEAetxjqR_3kx9_hJXbbyU8S6IN0.woff

我觉得这很奇怪——我之前开发了一个可以在 IE 10 中很好地加载 Google 字体的网站——我转到

对于 IE 11,Google Fonts 是否已被破坏?字体确实在 Edge、Chrome、Firefox 等中正确加载.我不知道如何继续让这些字体在 IE 中工作.

更新 1

在 IE 11 中将模拟文档模式设置为 8 会导致字体正确呈现.然而,IE 9+ 仍然存在同样的问题.这可能是 Google 处理的某种不正确的用户代理字符串吗?

更新 2

我去了 FontSquirrel 并下载了所有格式的 Open Sans.我还导入了 ZIP 中提供的 CSS.不幸的是,IE 和现在的 Firefox 继续报告无法使用该字体.Firefox 说可下载字体:平台不可用.

更新 3

我已确认 IE 的字体下载设置已针对所有安全区域设置为已启用.

解决方案

对我来说,这个问题是由 Windows 10 的一项名为不受信任的字体阻止的功能引起的.我的办公室网络在我们的组策略设置中启用了此功能.

<块引用>

使用此功能,您可以启用全局设置,阻止用户加载由图形设备接口 (GDI) 处理的不受信任的字体.不受信任的字体是安装在 %windir%/Fonts 目录之外的任何字体.https://support.microsoft.com/en-us/kb/3053676

要使用组策略禁用不受信任的字体阻止:

  1. 打开组策略管理编辑器
  2. 在本地计算机策略下,依次展开计算机配置、管理模板、系统,然后单击缓解选项.
  3. 在不受信任的字体阻止设置中选择不阻止不受信任的字体

要使用注册表编辑器禁用不受信任的字体阻止:

  1. 打开注册表编辑器 (regedit.exe) 并转到以下注册表子项:HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerKernel
  2. 如果 MitigationOptions 键不存在,请右键单击并添加一个新的 QWORD(64 位)值,将其命名为 MitigationOptions.
  3. 关闭此功能.输入 2000000000000.

重要提示:更改需要重启计算机才能生效

I am developing a website that uses the Google font Open Sans like so:

<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700italic,800italic,800,700' rel='stylesheet' type='text/css'>

Normally, I use Chrome when working with my website, but today I decided to see how it looks in IE 11 (11.0.10240.16431) on Windows 10. Unfortunately, Open Sans isn't being loaded and rendered properly. I see lots of these errors in the Developer Tools console:

CSS3111: @font-face encountered unknown error.
PRmiXeptR36kaC0GEAetxjqR_3kx9_hJXbbyU8S6IN0.woff

Thinking that was strange--I had previously developed a site that loaded Google Fonts just fine in IE 10--I headed on over to https://www.google.com/fonts. More CSS3111 errors, with every custom font being displayed in serif instead:

Is Google Fonts simply broken for IE 11? The fonts do load correctly in Edge, Chrome, Firefox, etc. I am at a loss for how to proceed to get these fonts to work in IE.

UPDATE 1

Setting the emulated document mode to 8 in IE 11 causes the fonts to render correctly. IE 9+ still exhibited the same issues, however. Is this some kind of incorrect user agent string processing by Google, perhaps?

UPDATE 2

I went to FontSquirrel and downloaded Open Sans in all its formats. I also imported the CSS provided in the ZIP. Unfortunately, IE and now Firefox continue to report that the font can't be used. Firefox says downloadable font: not usable by platform.

UPDATE 3

I've confirmed that IE's Font download setting is set to Enabled for all security zones.

解决方案

For me, this issue was caused by a Windows 10 feature called Untrusted Font Blocking. My office network had this turned on in our group policy settings.

Using this feature, you can turn on a global setting that stops users from loading untrusted fonts that are processed by the Graphics Device Interface (GDI). Untrusted fonts are any fonts that are installed outside the %windir%/Fonts directory. https://support.microsoft.com/en-us/kb/3053676

To disable Untrusted Font Blocking using Group Policy:

  1. Open Group Policy Management Editor
  2. Under Local Computer Policy, expand Computer Configuration, expand Administrative Templates, expand System, and then click Mitigation Options.
  3. In the Untrusted Font Blocking setting select Do not block untrusted fonts

To disable Untrusted Font Blocking using Registry Editor:

  1. Open Registry Editor (regedit.exe) and go to the following registry subkey: HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerKernel
  2. If the MitigationOptions key is not there, right-click and add a new QWORD (64-bit) Value, naming it as MitigationOptions.
  3. To turn this feature off. Type 2000000000000.

IMPORTANT: A computer restart is required for the changes to take effect

这篇关于IE 11:我自己的代码中出现错误 CSS3111,并且 google.com/fonts 不呈现任何字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆