# HG changeset patch # User Jim Blandy # Date 738335968 0 # Node ID 68de05fb57519f1cf90b4360880f437643c2c964 # Parent 08003ba2ac71d47f626fe75156c67fc00e04835a * 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. diff -r 08003ba2ac71 -r 68de05fb5751 lisp/faces.el --- a/lisp/faces.el Tue May 25 13:17:52 1993 +0000 +++ b/lisp/faces.el Tue May 25 13:19:28 1993 +0000 @@ -85,7 +85,8 @@ 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 @@ (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)