Mercurial > emacs
comparison lisp/faces.el @ 3071:68de05fb5751
* 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.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Tue, 25 May 1993 13:19:28 +0000 |
parents | 314cb8d34dcd |
children | 82c29bacb6b3 |
comparison
equal
deleted
inserted
replaced
3070:08003ba2ac71 | 3071:68de05fb5751 |
---|---|
83 (defsubst set-face-font (face font &optional frame) | 83 (defsubst set-face-font (face font &optional frame) |
84 "Change the font of face FACE to FONT (a string). | 84 "Change the font of face FACE to FONT (a string). |
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). |
92 If the optional FRAME argument is provided, change only | 93 If the optional FRAME argument is provided, change only |
93 in that frame; otherwise change each frame." | 94 in that frame; otherwise change each frame." |
410 "\\([-*?]\\|\\'\\)")) | 411 "\\([-*?]\\|\\'\\)")) |
411 (setq x-font-regexp-slant (concat - slant -)) | 412 (setq x-font-regexp-slant (concat - slant -)) |
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) |
418 (string-match x-font-regexp-weight font)) | 432 (string-match x-font-regexp-weight font)) |
419 (concat (substring font 0 (match-beginning 1)) which | 433 (concat (substring font 0 (match-beginning 1)) which |