GNOME Bugzilla – Bug 536185
monitor font configuration
Last modified: 2008-06-06 16:40:00 UTC
Attaching patch to add a new xsettings Fontconfig/Timestamp, and use it to refresh fonts by invalidating Pango's caches and requesting redraw. The counterpart to this is in bug 490374 that makes gnome-settings-daemon monitor all fontconfig configurations and set Fontconfig/Timestamp upon change. I really just needed a signal, but didn't know how to add that to gtksettings, so added an integer timestamp instead. This should also mean that installed fonts are picked up automagically. Didn't test that part yet, but verified that with these changes (and the gsd part), changing ~/.fonts.conf takes effect on running applications in a couple seconds. Any chance to get this into a release today?
Created attachment 111935 [details] [review] The patch The configure parts and #ifdef's can use some improvement. Currently hooks on x11 being the gdk backend to enable this.
Tested online font installation and it works too. W00t.
Hmm. Considering this is X specific, and you just need a signal, not a value, and alternative would be to trigger this via a root window property change, and handle it in gdkevents-x11.c...
Ideally this should go over dbus, as it's kinda host specific. But yeat, root window works better. Working on it.
Did the gdk part, but need to notify gtk still to do gtk_rc_reset_styles() on the settings object, right? I prolly can add a special xsettings event that causes just reset_styles(). Then make gdkevents-x11.c generate that for the PropertyNotify event I get.
Humm.. The clean way to do that is to add a new GdkEventType value. But that sounds like an overkill. The previous approach is broken too as it will only notify on the first screen and the other screens see that no configuration was changed so they will not notify.
I did the research now. Seems like there's a reason for xsettings existing in the first place :) : If we do a property on the root window, all GTK+ apps have to monitory for PropertyNotify on root window. A much much higher traffic than xsettings. So, I think we can safely go back to xsettings. I'll just update the patch to handle multi-screen correctly.
Sorry for sending you on that detour...
(In reply to comment #8) > Sorry for sending you on that detour... That's fine. Made me find a race condition in the current patch...
Created attachment 112183 [details] [review] Updated patch Updated patch that uses the timestamp value to correctly handle multi-screen scenarios. Can go in AFAIC. Going to commit the g-s-d part again.
Looks good to me. Do we want to move the clear_cache function into stable pango api, considering that it seems to be useful for something other than writing backends ?
Yep, already filed bug 536190 about making clear_cache public.
2008-06-06 Behdad Esfahbod <behdad@gnome.org> Bug 536185 – monitor font configuration * configure.in: * gdk/x11/gdksettings.c: * gtk/gtksettings.c (gtk_settings_class_init), (gtk_settings_notify), (settings_update_fontconfig): Monitor xsettings key Fontconfig/Timestamp and upon change, reread fontconfig configuration, clear Pango's caches, and redraw all widgets.