reddit / emacs

How to debug or solve the problem of "Font not available"?

yubrshen · 2022-06-18 13:52
With doom emacs, I have the following in my config.el (setq doom-font (font-spec :family "JetBrains Mono" :size 16) I evaluated it manually without any error, and M-x doom-reload-font, then I got the error: Font not available: #<font-spec nil nil JetBrains\ Mono nil nil nil nil nil 16 nil nil nil nil> and the desired font was not used in the emacs session. (With the above configuration, when starting doom emacs, I got the same error, which aborted the starting up the emacs session.) I checked my \~/.font directory, there are many font files that may match the specification. Furthermore, this problem only occur with certain unknown packages' upgrade, as the configuration used to work before the upgrade. Here are some samples of the fonts relevant that are available. ls -lt ~/.fonts/JetBrainsMono* -rwxrwxrwx 1 yshen yshen 68064 Oct 22 2021 /home/yshen/.fonts/JetBrainsMono-Thin.woff2* -rwxrwxrwx 1 yshen yshen 71180 Oct 22 2021 /home/yshen/.fonts/JetBrainsMono-ThinItalic.woff2*
ovopax · 2022-06-18 17:55
> (setq doom-font (font-spec :family "JetBrains Mono" :size 16) < Can't it be a typo? Try > (setq doom-font (font-spec :family "JetBrainsMono" :size 16) <
currious_636 · 2022-06-19 02:02
I tried both. Neither worked. However, the same settings used to be working. Only after an upgrade of some packages unknown that broken the font configurations.
goldensley · 2022-06-20 06:43
i'm not very familiar with doom-emacs, so I apologize if this isn't helpful. does JetBrains Mono show up in the output of fc-list? can you set the font globally with M-x menu-set-font?
yubrshen · 2022-12-21 07:45
Sorry for the late reply. The problem came back again. JetBrains Mono shows up in the output of fc-list. But it does not show up in the panel from M-x menu-set-font. I suspect that the fonts listed by fc-list may not be really accessible to emacs/doom. I'm running emacs/doom in a virtual machine with WSL1/Ubuntu, displaying with an X server. That configuration might cause some complications.