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

随声附和 提交于 2019-12-17 22:43:02

问题


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 GDI:


回答1:


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.



来源:https://stackoverflow.com/questions/8612266/why-cant-directx-directwrite-direct2d-text-rendering-be-as-sharp-as-gdi

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