Reputation: 545
I want to set the font to be used by a particular Gtk+ 3 application. How can it be done?
I know I can set the font to be used by all Gtk+ 3 applications in the file $XDG_CONFIG_HOME/gtk-3.0/settings.ini
, but I do not know how the font can be set for only a specific application.
Edit: I am not developing the application. I just want to run it with a font size different from the current one set for the desktop.
Upvotes: 0
Views: 5004
Reputation: 33
Modify the file ~/.config/gtk-3.0/settings.ini
according to your wishes for your specific application (i.e. font, font-size, theme, etc.).
Save it under ~/.config/somewhereelse/gtk-3.0
.
Run the application with XDG_CONFIG_HOME=$HOME/.config/somewhereelse your-application
Upvotes: 2
Reputation: 57854
Use GtkCssProvider
. You don't say what language you're using GTK in, so no code example, but here are the steps:
GtkCssProvider
*{font-family:'Comic Sans';}
) with gtk_css_provider_load_from_data()
gtk_style_context_add_provider_for_screen()
. (You probably want to use the default screen, gdk_screen_get_default()
.)Upvotes: 5