Change interface font in a GTK application at runtime without reopening windows
A lot of users are asking me for the capability to change the font of an application runtime. I know that the correct answer should be change your gtk theme or edit the application RC file, but while this kind of answer is good with power users, normal users often want to be able to grab a font from a list and quickly try it on the REAL application interface without the need of a restart. I know that I can change the font of a single widget with gtk_widget_modify_font(), and that I can change the font of EVERY future widget with something like: gtk_rc_parse_string(gtk-font-name=\sans 13\\n); But what if I want to change the font of the actual interface without having to close all the application window and open them again? I'm quite sure it's possible since I've seen a few apps doing it. Sadly I don't remember the apps, otherwise I'd go peek at their sources :) I think there should be cleaner way that a full iteration on the widget tree of every window and a gtk_widget_modify_font() Call on each widget, isn't it? :) Bye, Gabry ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Change interface font in a GTK application at runtime without reopening windows
Gabriele Greco wrote: A lot of users are asking me for the capability to change the font of an application runtime. I know that the correct answer should be change your gtk theme or edit the application RC file, but while this kind of answer is good with power users, normal users often want to be able to grab a font from a list and quickly try it on the REAL application interface without the need of a restart. I know that I can change the font of a single widget with gtk_widget_modify_font(), and that I can change the font of EVERY future widget with something like: gtk_rc_parse_string(gtk-font-name=\sans 13\\n); But what if I want to change the font of the actual interface without having to close all the application window and open them again? I'm quite sure it's possible since I've seen a few apps doing it. Sadly I don't remember the apps, otherwise I'd go peek at their sources :) I think there should be cleaner way that a full iteration on the widget tree of every window and a gtk_widget_modify_font() Call on each widget, isn't it? :) Not 100% sure, but this might be what you're looking for: http://library.gnome.org/devel/gtk/stable/gtk-Resource-Files.html#gtk-rc-reset-styles -brian ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list