diff options
| -rw-r--r-- | lisp/faces.el | 16 |
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)." | |||
| 85 | If the optional FRAME argument is provided, change only | 85 | If the optional FRAME argument is provided, change only |
| 86 | in that frame; otherwise change each frame." | 86 | in 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. | ||
| 418 | All wildcards in PATTERN become substantiated. | ||
| 419 | Given optional arguments FACE and FRAME, try to return a font which is | ||
| 420 | also 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) |