GNOME Bugzilla – Bug 773350
Source view doesn't use monospace font
Last modified: 2017-09-30 20:28:56 UTC
I use gitg 3.20.3 on Ubuntu 16.10. Gitg doesn't display source code with monospace font. My setting for monospace font is: ``` $ gsettings get org.gnome.desktop.interface monospace-font-name 'Ubuntu Mono 13' ```
I'm experiencing the same issue. ``` $ gsettings get org.gnome.desktop.interface monospace-font-name 'Monospace 11' ``` Affected is not only the source view, but also the diff and commit views. I'm not a GNOME user, so I'm not sure which app is supposed to even set this specific gsettings key, or if it's only set by the presence of a gnome-session; so I would of course appreciate a solution to this issue which will still work in my case. Being able to set the font in gitg itself would be even better.
Created attachment 339895 [details] gitg log with gtk theme "numix-archblue" I did some experimenting earlier, and it seemed that this bug did NOT occur if I changed my GTK theme to Adwaita (set using lxappearance as, as mentioned, I am not a user of 'full GNOME', nor of 'full LXDE'). When running `gitg` with Adwaita set, I got the minimal console output of: ``` [adam@rakka ~]$ gitg (gitg:6966): Gtk-WARNING **: Failed to get the GNOME session proxy: The name org.gnome.SessionManager is not owned (gitg:6966): Gtk-WARNING **: Failed to get the Xfce session proxy: The name org.xfce.SessionManager is not owned (gitg:6966): Gtk-WARNING **: Failed to get an inhibit portal proxy: The name org.freedesktop.portal.Desktop is not owned (gitg:6966): Gtk-WARNING **: A tag named 'invalid-char-style' is already in the tag table. (gitg:6966): GtkSourceView-CRITICAL **: gtk_source_style_apply: assertion 'GTK_IS_TEXT_TAG (tag)' failed (gitg:6966): Gtk-CRITICAL **: gtk_text_tag_set_priority: assertion 'GTK_IS_TEXT_TAG (tag)' failed (gitg:6966): Gtk-CRITICAL **: gtk_text_buffer_apply_tag: assertion 'GTK_IS_TEXT_TAG (tag)' failed ``` along with one or two warnings about strange characters in one of my repo's source files, which I won't duplicate. But the important thing was that the monospace fonts were working as expected. However, when I ran with either of the GTK themes I normally use (namely Numix-ArchBlue or the sadly currently abandoned Shiki-Brave-Classic/Revival, the output was as in the attached file. I decided thus to try updating Numix-ArchBlue, which it seems was installed on my system from -git, and was at least a few weeks (probably months) out of date. After doing this, and setting that again to be the currently active GTK theme, lo and behold: monospace fonts started working! I therefore consider this bug to be fixed "for me", but instead of just leaving it at that, I thought it might at least be useful to post a little info about what I found out. Maybe this will assist either the gitg developers, or be useful for other affected users using GTK themes which still trigger this behaviour.
I found a fix, by hacking the Ambiance theme: https://quan.hoabinh.vn/blog/2017/6/46-fix-gitg-doesn-t-use-monospace-font-in-ubuntu
So this is actually a bug in themes that are not Adwaita, not in gitg. Closing, feel free to report to the relevant tracker for the themes that exhibit the issue.