如何在Linux上对LCD字体(Windows上的cleartype)进行亚像素渲染?

发布于 2024-08-06 02:29:09 字数 315 浏览 6 评论 0原文

我正在研究嵌入式系统,拥有自己的窗口系统和渲染库。有一天,当我安装 Ubuntu 时,令我惊讶的是它具有 LCD 子像素渲染功能。将它安装在我的设备上看起来真的很酷。因为它的可读性很强。

目前,我要求 freetype 中的特定字形,freetype 为我提供了一个具有 alpha 值的内存缓冲区,因此不可能进行子像素渲染。我拥有的是普通的抗锯齿字体。与子像素一样 - 渲染字体最左边的像素用红色抗锯齿,最右边的像素用蓝色抗锯齿(假设屏幕是 RGB )。

freetype 是否有任何方法可以为我提供当前像素是左、右还是 centerone 的信息?

谢谢,桑尼。

I am working on embedded system, with own windowing system and rendering library. Before someday when I installed Ubuntu, to my surprise it has LCD subpixel rendering. It really looks cool to have it on my device. Because it is very readable.

Currently I ask for particular glyph in freetype, freetype gives me one memory buffer with values of alpha, with that it is not possible to have subpixel rendering. What I have is normal antialiazed font. As in subpixel - rendering left most pixel of font is anti-aliazed with Red and Rightmost with Blue ( Assuming Screen is RGB ).

Is there any methods with which freetype can give me information that whether current pixel is left or right or centerone?

Thanks, Sunny.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

寄意 2024-08-13 02:29:09

freetype 可以做到

freetype can do it

娇妻 2024-08-13 02:29:09

正如您所指出的,您正在使用的桌面环境(GNOME、KDE ​​等等)可能会实现这一点。它的设置因环境而异。

至于如何在您自己的代码中执行此操作,您可以使用与窗口管理器相同的例程(GNOME 上的 Gtk+,KDE 上的 Qt 等),或者您可以使用单独的库,例如 FreeTypeSDL_ttf< /a>.抗锯齿——通用术语,因为 ClearType 是 Microsoft 特有的专利算法——在这些库中通常是可选的,默认情况下禁用以提高速度。

As you point out, the desktop environment you're using (GNOME, KDE, whatever) may implement this. The setting for it varies by environment.

As to how to do it in your own code, you can use the same routines the window manager does (Gtk+ on GNOME, Qt on KDE, etc.), or you can use a separate library like FreeType or SDL_ttf. Antialiasing -- the generic term for this, as ClearType is a patented algorithm specific to Microsoft -- is usually optional in these libraries, disabled by default for speed.

云淡月浅 2024-08-13 02:29:09

我认为 libcairo 是 Ubuntu 中大多数进行抗锯齿处理的 GTK 应用程序的底层。我认为是否专门针对 LCD 屏幕进行子像素渲染是用户选择的事情,而不是应用程序作者的选择。用户通过系统->外观首选项的“字体”选项卡进行控制。首选项->外观(可以作为二进制“gnome-appearance-properties”手动运行)并单击“子像素平滑(LCD)”选项。

也许应用程序可以通过某种方式自行覆盖此设置?但不确定他们为什么想要这样做,因为应用程序无法控制用户使用的显示器类型。

I think that libcairo is at the bottom of most GTK applications in Ubuntu that do antialiasing. I think that whether subpixel rendering is done specifically for an LCD screen is something the user chooses, not the application author. The user controls it through the "Fonts" tab of "Appearance Preferences" in System -> Preferences -> Appearance (which can be run manually as the binary "gnome-appearance-properties") and clicking on the "Subpixel smoothing (LCDs)" option.

Maybe there's a way that an application can override this setting for themselves? Not sure why they'd want to, though, since an app doesn't control what kind of display the user is using.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文