summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJim Blandy <jimb@redhat.com>1993-05-25 13:19:28 +0000
committerJim Blandy <jimb@redhat.com>1993-05-25 13:19:28 +0000
commit9600399dbd5f84a1da48aa096418a278a13c4755 (patch)
tree49ae76c884fd4a6db54916db3a7c2ebe9243076a /lisp
parent7d53993cbd75f37b243b50ccf9149043a3f16b25 (diff)
downloademacs-9600399dbd5f84a1da48aa096418a278a13c4755.tar.gz
* faces.el (set-face-font): Call x-resolve-font-name on the font
before including it in the face. (x-resolve-font-name): New function.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/faces.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/faces.el b/lisp/faces.el
index 34b88ff5950..ee603321460 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -85,7 +85,8 @@ Otherwise report on the defaults for face FACE (for new frames)."
If the optional FRAME argument is provided, change only
in that frame; otherwise change each frame."
(interactive (internal-face-interactive "font"))
- (internal-set-face-1 face 'font font 3 frame))
+ (internal-set-face-1 face 'font (x-resolve-font-name font face frame)
+ 3 frame))
(defsubst set-face-foreground (face color &optional frame)
"Change the foreground color of face FACE to COLOR (a string).
@@ -412,6 +413,19 @@ set its foreground and background to the default background and foreground."
(setq x-font-regexp-weight (concat - weight -))
nil)
+(defun x-resolve-font-name (pattern &optional face frame)
+ "Return a font name matching PATTERN.
+All wildcards in PATTERN become substantiated.
+Given optional arguments FACE and FRAME, try to return a font which is
+also the same size as FACE on FRAME,"
+ (let ((fonts (x-list-fonts pattern face frame)))
+ (or fonts
+ (if face
+ (error "no fonts match `%S'." pattern)
+ (error "no fonts matching pattern are the same size as `%s'."
+ pattern face)))
+ (car fonts)))
+
(defun x-frob-font-weight (font which)
(if (or (string-match x-font-regexp font)
(string-match x-font-regexp-head font)