Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
740 views
in Technique[技术] by (71.8m points)

winapi - Why can't DirectX/DirectWrite/Direct2D text rendering be as sharp as GDI?

I already know that sub-pixel positioning causes DirectWrite text rendering to be blurry compared to GDI.

However, my question is a bit more fundamental: Why can't DirectWrite (and related methods) be made to render text as sharply as GDI?

In other words:
What prevents DirectWrite from being able to snap text to the nearest pixel, the way GDI can?

Is it, for example, a hardware issue? A driver architecture issue? Is it simply not implemented? Or something else?


Smaller sample:

Larger samples:

Direct2D, aliased:

Direct2D, default:

Direct2D ("classic GDI"):

Direct2D ("natural GDI"):

Actual classic GDI:

![](http://i.stack.imgur.com/kbdPb.png)

Actual ClearType GDI:

enter image description here


Note: If all of these look blurry to you, run

document.body.style.zoom = 1 / window.devicePixelRatio

in Chrome's console and view it afterward.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You aren't comparing like with like. Your Direct2D samples are all rendered in grayscale, whereas the GDI and Linux samples are using sub-pixel anti-aliasing (aka ClearType on Windows).

This page describes what you need to do to enable cleartype: http://msdn.microsoft.com/en-us/library/windows/desktop/dd368170%28v=vs.85%29.aspx

N.B. When testing rendering like this, it's always worth using Windows Magnifier or similar to check that you are actually getting what you think you are getting.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...