aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/faces.el
diff options
context:
space:
mode:
authorJim Blandy1993-05-25 13:19:28 +0000
committerJim Blandy1993-05-25 13:19:28 +0000
commit281dc1c259d522bf078b975e249abeb2d31ff3cb (patch)
tree67d43899f61080f76428bf7aeb8ee4b9e6365dff /lisp/faces.el
parentdb176f55de95d1ec95806fdf08ad336c30ece852 (diff)
downloademacs-281dc1c259d522bf078b975e249abeb2d31ff3cb.tar.gz
emacs-281dc1c259d522bf078b975e249abeb2d31ff3cb.zip
* 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/faces.el')
-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)."
85If the optional FRAME argument is provided, change only 85If the optional FRAME argument is provided, change only
86in that frame; otherwise change each frame." 86in that frame; otherwise change each frame."
87 (interactive (internal-face-interactive "font")) 87 (interactive (internal-face-interactive "font"))
88 (internal-set-face-1 face 'font font 3 frame)) 88 (internal-set-face-1 face 'font (x-resolve-font-name font face frame)
89 3 frame))
89 90
90(defsubst set-face-foreground (face color &optional frame) 91(defsubst set-face-foreground (face color &optional frame)
91 "Change the foreground color of face FACE to COLOR (a string). 92 "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."
412 (setq x-font-regexp-weight (concat - weight -)) 413 (setq x-font-regexp-weight (concat - weight -))
413 nil) 414 nil)
414 415
416(defun x-resolve-font-name (pattern &optional face frame)
417 "Return a font name matching PATTERN.
418All wildcards in PATTERN become substantiated.
419Given optional arguments FACE and FRAME, try to return a font which is
420also the same size as FACE on FRAME,"
421 (let ((fonts (x-list-fonts pattern face frame)))
422 (or fonts
423 (if face
424 (error "no fonts match `%S'." pattern)
425 (error "no fonts matching pattern are the same size as `%s'."
426 pattern face)))
427 (car fonts)))
428
415(defun x-frob-font-weight (font which) 429(defun x-frob-font-weight (font which)
416 (if (or (string-match x-font-regexp font) 430 (if (or (string-match x-font-regexp font)
417 (string-match x-font-regexp-head font) 431 (string-match x-font-regexp-head font)