Gtk更改应用程序的字体和字体颜色 [英] Gtk Change Font and font color for an application

查看:782
本文介绍了Gtk更改应用程序的字体和字体颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Gtk +和C应用程序,我希望将字体设置为某种XYZ字体类型和字体颜色为蓝色,用于应用程序中的所有标签和文本如何一次性执行此操作,我有使用Glade RAD工具开发了所有屏幕,目前我正在通过为每个标签调用以下功能来完成此操作。

I am having one Gtk+ and C application in which i want to set the font to some XYZ font type and font color to blue, for all the labels and text in the application how can i do this in one go, I have developed all the screen using Glade RAD tool, and currently i am doing this by calling following function for each label.

gtk_label_set_markup( label,"<span font='FONT NAME' foreground='#FFFFFF' size='large'><b>MY Text</b></span>");

那么我该如何告诉Gtk为每个标签和每个小部件使用我的字体和字体颜色在应用程序中。

So how can i tell the Gtk to use my font and font color for every label and for every widget in the application.

感谢,

推荐答案

不好的形式来做到这一点;应用程序应该尊重用户的主题。也就是说,您可以使用您想在应用程序中重写的设置来部署资源文件,然后使用 gtk_rc_parse()在运行时加载文件。

It is generally considered bad form to do that; apps should respect the user's theme. That said, you can deploy a resource file with the settings you want to override in your application, and then use gtk_rc_parse() to load the file at runtime.

检出 GTK + Resource Files文档了解详情。

这篇关于Gtk更改应用程序的字体和字体颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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