From c21e45a2f7160ea887214c282a9e105948db6a89 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 12 Oct 2024 20:55:47 +0300 Subject: [PATCH] Improve face font selection on MS-Windows * lisp/net/dictionary.el (dictionary-word-definition-face): Special-case w32. * lisp/faces.el (face-font-family-alternatives): Add a few modern font families. (cherry picked from commit 7d9513f9c48ba4d197502ad8196d51f18894145e) --- lisp/faces.el | 7 +++++-- lisp/net/dictionary.el | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lisp/faces.el b/lisp/faces.el index 27f5a705190..75dfa50ac0c 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -100,7 +100,7 @@ a font height that isn't optimal." ;; which are generally available. (defcustom face-font-family-alternatives (mapcar (lambda (arg) (mapcar 'purecopy arg)) - '(("Monospace" "courier" "fixed") + '(("Monospace" "Cascadia Code" "Lucida Console" "courier" "fixed") ;; Monospace Serif is an Emacs invention, intended to work around ;; portability problems when using Courier. It should work well @@ -133,7 +133,10 @@ a font height that isn't optimal." ;; This is present for backward compatibility. ("courier" "CMU Typewriter Text" "fixed") - ("Sans Serif" "helv" "helvetica" "arial" "fixed") + ("Sans Serif" + ;; https://en.wikipedia.org/wiki/List_of_typefaces_included_with_Microsoft_Windows + "Calibri" "Tahoma" "Lucida Sans Unicode" + "helv" "helvetica" "arial" "fixed") ("helv" "helvetica" "arial" "fixed"))) "Alist of alternative font family names. Each element has the form (FAMILY ALTERNATIVE1 ALTERNATIVE2 ...). diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 2b41ef55697..6b26456cb44 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -320,7 +320,11 @@ Otherwise, `dictionary-search' displays definitions in a *Dictionary* buffer." :version "30.1") (defface dictionary-word-definition-face - '((((supports (:family "DejaVu Serif"))) + ;; w32 first, because 'supports' doesn't really tell whether the font + ;; family exists, and MS-Windows selects an ugly font as result. + '((((type w32)) + (:font "Sans Serif")) + (((supports (:family "DejaVu Serif"))) (:family "DejaVu Serif")) (((type x)) (:font "Sans Serif")) @@ -328,7 +332,7 @@ Otherwise, `dictionary-search' displays definitions in a *Dictionary* buffer." (:font "default"))) "The face that is used for displaying the definition of the word." :group 'dictionary -:version "28.1") +:version "31.1") (defface dictionary-word-entry-face '((((type x)) -- 2.39.5