Disable Cleartype (text anti-aliasing) in IE9

拟墨画扇 提交于 2019-11-28 06:56:16
Justin Grant

After a few days of searching, I found an MSDN Forums thread which pointed me to a solution here: http://www.softwareninjas.ca/dwrite-dll-wrapper

Follow the instructions on that page and you'll remove anti-aliasing from IE9 (at least the 32-bit version of IE which is the default IE, even on 64-bit Windows 7). I've tested it so far on a Win7 x64 laptop and it worked flawlessly.

Big thanks to Olivier Dagenais who built this. Here's a technical summary of how his solution works.

It's a two-step process. First, you need to disable ClearType in IE via a registry key. This is the same setting which was available in previous versions of IE, but it was removed from the IE UI because it stopped working in IE9.

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"UseClearType"="no"

Second, now that ClearType is disabled, Windows will fall back to a non-cleartype anti-aliasing solution. Now that fallback anti-alising also needs to be disabled. Quoting from the thread above:

What is left is the font smoothing (aka sub-pixel rendering), and that is the "blurring effect" you still see after turning cleartype off.

In case you were wondering, there is a way to turn that off too.

The method i used to turn off the sub-pixel wonder is to build a simple wrapper for dwrite.dll which intercepts and forwards calls to the real dwrite.dll, disabling font smoothing in the process.

You can download it from: http://www.softwareninjas.ca/dwrite-dll-wrapper

You can find the code at https://softwareninjas.kilnhg.com/Repo/Open-Source/Group/DWrite-dll-Wrapper

This was a pretty cool hack. Probably somewhat brittle across windows and DirectX releases, but will do the trick for now until Microsoft gets their act together to fix the underlying "can't disable anti-aliasing" problem in IE itself.

It also works for apps which use the IE WebBrowser control (aka MSHTML), so you can control anti-aliasing on an app-by-app basis. It also works for the HTML Help viewer.

Note that the text quality in IE9 standards mode isn't ideal. Specifically, small fonts sometimes have letters sometimes run together without the usual one-pixel space between them. If you render the same page in compatibility mode (or your site uses a non-strict DTD or other non-standards-enforcing DTD), then it looks fine. So there's an additional step for some sites if they want the best aliased text rendering: just view a site in compatibility mode by pressing the compatibility button in IE's toolbar.

David d C e Freitas

To answer your question directly:

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">

The other thing to consider is to try avoid point based font sizes.


Important information regarding fonts, blurriness and rendering in IE9

MSDN sources:

The info here solves two problems: 1. Getting rid of cleartype and font smoothing in IE9 2. Getting rid of cleartype and font smoothing when IE10 is installed or installs itself automatically

I had done a registery hack to turn off cleartype in IE9: [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main] "UseClearType"="no" and used a little piece of freeware to get rid of font smoothing in IE9: https://softwareninjas.kilnhg.com/Repo/Open-Source/Group/DWrite-dll-Wrapper

Then IE10 automatically installed itself and the blurry type was back. I tried uninstalling IE 10, which wasn't through the add/remove programs interface but rather through the installed updates interface--removing the IE10 update. That ostensibly took me back to IE9, but the blurry type remained in spite of the fact that "no" was still the answer for cleartype in the registry and the two .dll files were still in my IE program folder.

So, I decided to uninstall IE9 and reinstall it. That also involved going through the installed updates interface and removing the IE9 update.

I rebooted and expected to have to reinstall the program, but my IE icon was still there. When I clicked it, IE9 opened with nice, sharp type.

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