Friday, November 11, 2016

Rebuilding Fonts

Fonts, printers, scanners, sound, and usb connected items: have a sense a humor if you intend to deal seriously with these in Linux.

Anyway, too often during an Arch update, there will be a conflict in the fonts, sometimes between already installed fonts and one intending to update itself through pacman. When this happens, the entire update of all packages can be scotched when pacman exits, or perhaps the user will be forced to deal with /etc/fonts/fonts.conf in some immediate way.

Arch uses fontconfig, so I sometimes solve these conflicts by deleting everything inside /etc/fonts/. Since /etc/fonts/font.conf is eliminated along with other files, any conflicts in /etc/fonts are eliminated and pacman can complete its update. However, after this nuclear method, fonts will be mangled. They cannot be repaired with a simple # fc-cache -vf. Even that action will spew errors that it can't find a /etc/fonts/font.conf file instead of running a subroutine that simply builds such a file. Programmers.

So, how to rebuild /etc/fonts/font.conf? Turns out there's a lot of information about how to edit /etc/fonts/font.conf , but no information about re-building it. The solution was only obtained via frustration after attempting various manually constructed versions of /etc/fonts/font.conf which failed:
# pacman -S fontconfig
That's right, the only thing that worked for me was to re-install the f**king package. Of course, I'm an idiot, but still. Also, be sure to explicitly update one's fonts after a pacman update, in case pacman left any hanging chads.
# fc-cache -fv
Alternatively, when one runs into a font problem, a person can exit their update noting the name of the font that is causing the problem, and then rerun the update excluding that font until one has determined the conflict.
# pacman -Syu --ignore font-foo

No comments: