Change GNOME Shell font

Having switched to Gentoo I had to look for a desktop environment to replace Unity, which I've been using for years under Ubuntu. I tried to use XFCE and KDE 5 for some months, but... just no (and I'm being very kind). Luckily I found an overlay for GNOME without systemd, including some extra patches to restore deprecated behaviours.

With the proper extensions installed it's quite usable, but I noticed an option for setting the shell font was missing.

cantarell_vs_sourcesanspro

Since GNOME Shell themes are basically CSS you can modify whatever you want in a fairly simple way, provided that you know where to look. If you are using the default theme create a file named .local/share/themes/<NewThemeName>/gnome-shell/gnome-shell.css (also create the eventually missing folders), in this example I'm using Source Sans Pro, 10pt:

stage {
	font-family: "Source Sans Pro";
	font-size: 10pt;
}
/* Fixed icons size in GNOME Shell panel */
#panel .panel-button .system-status-icon {
	icon-size: 16px;
	padding-top: 0px;
	padding-bottom: 0px;
}
/* Fixed icons size in GNOME Shell panel menus */
.popup-menu-icon {
	icon-size: 16px;
}

The last two rules are necessary to avoid blurry icons in the panel

blurry_icons

If you are using a custom theme and it's not the first time you hear about CSS, you may already know what to do. Anyway, here's an example based on Arc theme (the last fad, no one seems to give a damn about the "superb" (cit.) Numix anymore):

@import "/usr/share/themes/Arc/gnome-shell/gnome-shell.css";
stage {
	font-family: "Source Sans Pro";
	font-size: 10pt;
}

Set your preferred font and select the new theme from GNOME Tweak Tool.