简体   繁体   English

为什么 DirectX/DirectWrite/Direct2D 文本渲染不能像 GDI 一样清晰?

[英]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 .我已经知道与 GDI 相比,子像素定位会导致DirectWrite 文本渲染模糊

However, my question is a bit more fundamental: Why can't DirectWrite (and related methods) be made to render text as sharply as GDI?但是,我的问题更基本一点:为什么不能让 DirectWrite(和相关方法)像 GDI 一样清晰地呈现文本?

In other words:换句话说:
What prevents DirectWrite from being able to snap text to the nearest pixel, the way GDI can?是什么阻止DirectWrite 能够像 GDI 那样将文本捕捉到最近的像素?

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,别名:

Direct2D, default: Direct2D,默认:

Direct2D ("classic GDI"): Direct2D(“经典 GDI”):

Direct2D ("natural GDI"): Direct2D(“自然 GDI”):

Actual classic GDI:实际经典 GDI:

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

Actual ClearType GDI:实际ClearType GDI:

在此处输入图片说明

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).您的 Direct2D 示例都以灰度呈现,而 GDI 和 Linux 示例使用子像素抗锯齿(在 Windows 上也称为 ClearType)。

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此页面描述了启用 cleartype 所需的操作: http : //msdn.microsoft.com/en-us/library/windows/desktop/dd368170%28v=vs.85%29.aspx

NB 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. NB 在测试这样的渲染时,总是值得使用 Windows 放大镜或类似工具来检查您是否实际获得了您认为获得的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM