[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 3d6137116f6: Allow font-spec in 'face-font-rescale-alist' set at
From: |
Eli Zaretskii |
Subject: |
master 3d6137116f6: Allow font-spec in 'face-font-rescale-alist' set at startup |
Date: |
Thu, 15 Feb 2024 05:06:00 -0500 (EST) |
branch: master
commit 3d6137116f6be8ee38f9f49c9811b97ef92e0e58
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Allow font-spec in 'face-font-rescale-alist' set at startup
* lisp/startup.el (startup--rescale-elt-match-p): New function.
(normal-top-level): Use it, instead of the naive 'string-match-p',
to match the default font against the elements of
'face-font-rescale-alist'. Reported by Rahguzar
<rahguzar@zohomail.eu>.
---
lisp/startup.el | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/lisp/startup.el b/lisp/startup.el
index 773765a4b97..1c21b5de857 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -556,6 +556,17 @@ the updated value."
(setq startup--original-eln-load-path
(copy-sequence native-comp-eln-load-path))))
+(defun startup--rescale-elt-match-p (font-pattern font-object)
+ "Test whether FONT-OBJECT matches an element of `face-font-rescale-alist'.
+FONT-OBJECT is a font-object that specifies a font to test.
+FONT-PATTERN is the car of an element of `face-font-rescale-alist',
+which can be either a regexp matching a font name or a font-spec."
+ (if (stringp font-pattern)
+ ;; FONT-PATTERN is a regexp, we need the name of FONT-OBJECT to match.
+ (string-match-p font-pattern (font-xlfd-name font-object))
+ ;; FONT-PATTERN is a font-spec.
+ (font-match-p font-pattern font-object)))
+
(defvar android-fonts-enumerated nil
"Whether or not fonts have been enumerated already.
On Android, Emacs uses this variable internally at startup.")
@@ -816,8 +827,9 @@ It is the default value of the variable `top-level'."
(when (and (display-multi-font-p)
(not (eq face-font-rescale-alist
old-face-font-rescale-alist))
- (assoc (font-xlfd-name (face-attribute 'default :font))
- face-font-rescale-alist #'string-match-p))
+ (assoc (face-attribute 'default :font)
+ face-font-rescale-alist
+ #'startup--rescale-elt-match-p))
(set-face-attribute 'default nil :font (font-spec)))
;; Modify the initial frame based on what .emacs puts into
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 3d6137116f6: Allow font-spec in 'face-font-rescale-alist' set at startup,
Eli Zaretskii <=