MSIE 10, web font and font-feature-settings causes invisible text

谁都会走 提交于 2019-12-03 12:48:17

My suggestion is to remove the font-feature-setting property, as it is not making the text easier to read.

The reason is that only IE supports font-feature-setting. All other browsers are dropping the property, and thus there is no change to text rendering in non-IE browsers.

WebKit and Blink browsers do support the property with a webkit prefix, and Firefox supports it with a moz prefix, but they do not support the prefixless one used in the jsFiddle.

If you must use this and not give it to IE, you could add the moz and webkit prefixes and remove the prefixless version, but bear in mind that it will then never use this property in IE, and will be dropped in other browsers if they ever remove their prefixed version.

Note: it looks like using this property makes the text invisible in IE10 and 11 on Windows 7, but works as expected in IE10 and 11 on Windows 8.x.

This is a bug: causing text to disappear in IE10 and IE11 when the font-feature-settings css property is used https://connect.microsoft.com/IE/feedbackdetail/view/831964

Windows 7 users using Internet Explorer 10 or 11 are experiencing a bug that causes text to disappear when font-feature-settings are utilized. https://connect.microsoft.com/IE/feedbackdetail/view/831964

Windows 8 users do not experience the same issue.

If you have a lot of users using Windows 7 then simply removing font-feature-settings and -ms-font-feature-settings will cause the text to display.

I would still advice you to turn kerning on in the other browsers if you want text to display the same in all other browsers. You can ensure forward and backward compatibility like this:

.kern {
  -webkit-font-feature-settings: "kern" 1;
  -moz-font-feature-settings: "kern" 1;
  -moz-font-feature-settings: "kern=1";
  -o-font-feature-settings: "kern" 1;
  font-kerning: normal;
}

You can use javascript if you still want to present windows 8 and 10 users with kerning.

kern.css:

.kern {
  -webkit-font-feature-settings: "kern" 1;
  -moz-font-feature-settings: "kern" 1;
  -moz-font-feature-settings: "kern=1";
  -o-font-feature-settings: "kern" 1;
  font-kerning: normal;
}

.kern-ie {
  font-feature-settings: "kern" 1;
  -ms-font-feature-settings: "kern=1";
}

kern.js:

var ua = navigator.userAgent.toLowerCase();
var isNotWin7 = ua.indexOf('windows nt 6.1') == 0;
if (isNotWin7) {
    var kernedTextCollection = getElementsByClassName(".kern");
    for(var i = 0; i < kernedTextCollection.length; i++) {
        kernedTextCollection.item(i).className = kernedTextCollection.item(i).className + ' kern-ie';
    }
}

index.html:

<link rel="stylesheet" type="text/css" href="kern.css">
<!--[if IE]>
    <script src="kern.js"></script>
<![endif]-->

I had the same issue today and after doing some research I came to this simple conclusion.

Remove custom kerning settings and let the browser decide, when to use kerning and when not to use kerning. It is the default setting and is working just fine. :-)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!