IE 9 does not use sub-pixel antialiasing under certain conditions

亡梦爱人 提交于 2019-11-27 08:04:56

It seems setting opacity:.9999 on body renders the text in IE9 standards mode a lot more similar to how it does in Quirks mode.

Short answer: this is an issue when you specify font sizes in pt (points), rather than pixels.

So what happens is that the new IE9 rendering engine uses DirectWrite, which won't snap to the nearest pixel as it did with GDI+, so if your pt size doesn't map to a whole pixel number, it will draw it exactly that way, which makes it appear blurry.

The IE8 compatibility mode wouldn't suffer this issue as it uses regular GDI rendering that we are used to.

So check out all your style sheets etc and if you are asking for point size font's, that's exactly what will be given in IE9, and depending on your font used etc, your point size might or might not map to a crisp and clear size.

This is explained in detail here:

Stephen Chung

IE9 in standard mode uses sub-pixel addressing for text. One can say that it "smooths out" text characters, or you can say the reverse, i.e. it "blurs out" the characters. It is essentially the same thing.

Personally I do not find any easily-perceivable differences between your three images, and actually prefer the first one. However, it depends on personal preferences.

I've searched the web a bit, and it doesn't seem to be a way to cleaning turn off sub-pixel rendering on IE9. This link might interest you: Disable Cleartype (text anti-aliasing) in IE9

In WPF, there is an option to turn off sub-pixel font rendering and force letters to "snap to pixels". But IE9 doesn't seem to have such a switch.

However, my recommendation is: is it that big a problem that you'd want to do it in the first place? If sub-pixel text rendering gives you very ugly output on your site (are you using lots of very small type?), perhaps you'll need to rethink your site layout in the first place. Type that is so small that sub-pixel rendering makes them unclear is best avoided in a web site.

And there is no telling when other browsers will add sub-pixel rendering to text in the future -- in fact FF4 already uses Direct2D, but may not be using DirectWrite.

Internet Explorer 9 seems to stop using sub-pixel antialiasing under really random conditions. For example, here is another example that triggers it (I assume there are more):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML><HEAD>
<TITLE></TITLE>
<BODY>
Outside the div - with sub-pixel AA. :)
<div style="border-radius: 1px; overflow: hidden;">
Inside the div - no sub-pixel AA. :(
</div>
</BODY></HTML>

The text inside the div will not be rendered with sub-pixel ("colored") anti-aliasing, but the text outside of it will. Both the border-radius and the overflow declarations are necessary to trigger the bug.

(Can someone please try if it happens on their system and leave a comment? I'd be interested to know if the bug is only triggered on certain system configurations.)

If you switch the Document Mode in the IE Developer Tools to anything but "IE9 standards", the issue disappears.

I'm personally almost willing to live with it, but if it really bothers you I'd suggest stripping down your stylesheet step by step to track down what triggers it.

The only way I can make the fonts look good is to fall back to IE8 functionality via:

<meta http-equiv="x-ua-compatible" content="IE=8" />

The Microsoft update http://support.microsoft.com/kb/2545698 had already been installed, and I already use font-size: 11px;

The opacity:.9999 solution was better then nothing, but not as good as what the IE8 mode shows.

ClearType font rendering is used in all IE9 document modes; sub-pixel positioning is used only in IE9’s default standards mode. IE9’s compatibility modes—Quirks, 7, and 8—use whole-pixel text metrics.

So try switching your doctype to use Quirks mode:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

or

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

or one of the compatibility modes.

More info from MSDN

If you need to use IE and you hate that smoothing like on this image http://i.stack.imgur.com/SViG0.png Try turn ON Compatibility View (ALT+T to show Tools menu)

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