Ensure default font family is always valid

If the default face's font is unspecified, then just use "monospace".
This commit is contained in:
TEC 2021-09-11 15:46:11 +08:00
parent f8204e82dc
commit fdd1692a4c
Signed by: tec
GPG Key ID: 779591AFDB81F06C
1 changed files with 3 additions and 1 deletions

View File

@ -112,7 +112,9 @@ Run after hardcoded setup, but before the screenshot is captured."
(screenshot--define-infix
"-ff" "font-family" "Font family to use"
'string (symbol-name (font-get (face-attribute 'default :font) :family))
'string (let ((font (face-attribute 'default :font)))
(if (eq font 'unspecified) "monospace"
(symbol-name (font-get font :family))))
(if (fboundp #'counsel-fonts)
(ivy-read "Font: " (delete-dups (font-family-list))
:preselect screenshot-font-family