如何为特定的gtk +应用程序设置抗锯齿模式 [英] How to set anti-aliasing mode for specific gtk+ application

查看:456
本文介绍了如何为特定的gtk +应用程序设置抗锯齿模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用 pygobject 编写简单的 gtk + 应用程序.gnome.org / gtk3 / stable / GtkTextView.htmlrel =nofollow> gtk.TextView 。有库存演示代码 I看到该字体设置为 Pango ,但我找不到设置抗锯齿模式的相应方法。默认情况下,字体看起来对我来说很难看。



有人知道如何在gtk +应用程序中设置消除锯齿(使用Python或纯C,Pango或其他方式)?

好吧,这并不容易。许多因素相互作用,以获得屏幕上的最终字体字形。



也许改变全局反锯齿的最简单方法之一是重新编程 fontconfig 本文介绍如何禁用 抗锯齿功能,但它指示配置项目的位置。

然后,在每个应用程序的基础上,绘制角色的实际工作由 Pango ,但Pango可能被编程为使用Xft(fontconfig)或Cairo进行实际绘制。在开罗(似乎正在流行)的情况下,反锯齿在那里完成。有关于此的这篇文章在stackoverflow上。基本上在开罗图书馆有一个功能,称为'cairo_set_aliasing'



编辑:查看XFCE窗口管理器。在设置 |中 Appearance 工具,您可以将全局反锯齿从'无','轻微','更多'更改为'全',并选择颜色或灰色的子像素,水平/垂直和细节。代码包含在XFCE的 xfce4-appearance-settings 模块中。



别名设置位于 xfce4-settings-4.12.0.tar.bz2 ,位于 dialogs / appearance-settings / main.c 中。我不确定它是否真的在那里激活。我目前做了很多工作,但如果有必要,以后可以借给你。


I trying to write simple gtk+ application with pygobject that using gtk.TextView. In stock demo code I see that font sets up with Pango, but I can't find corresponding method for set up antialiasing-mode. By default font looks little ugly for me.

Does anybody know how to set anti-aliasing in gtk+ app (with python or pure C, Pango or other way)?

解决方案

Well, it's not easy. Many factors interact to get the final font glyphs on your screen.

Maybe one of the easiest ways to change antialiasing globally would be to reprogram fontconfig. This article describes how to disable anti-aliasing, but it indicates where the config item is located.

Then, on a per-application basis, the actual work of drawing the characters is in the hands of Pango, but Pango may be programmed to use Xft (fontconfig) or Cairo to do the actual drawing. In case of Cairo (which seems to gather popularity), the anti-aliasing is done there. There's an article on that here on stackoverflow. Basically there's a function in the Cairo library, called 'cairo_set_aliasing'

Edit: Have a look at the XFCE window manager. In ths Settings | Appearance tool, you can change the anti aliasing 'globally', from 'none', 'slight', 'more' to 'full', and select subpixel in color or gray, horizontal/vertical and details. The code is contained in the xfce4-appearance-settings module of XFCE.

The aliasing setup is in xfce4-settings-4.12.0.tar.bz2, in dialogs/appearance-settings/main.c. I'm not sure if it actually activated there. I've quite a lot of work at the moment, but, if necessary can lend you a hand later.

这篇关于如何为特定的gtk +应用程序设置抗锯齿模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆