问题
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